Question

My web application immediately redirects users to a login page via web.config. How can I get the url that requested my page? I tried using the Request paramaters in Page_Load of the Login.aspx page but that didn't work.

Was it helpful?

Solution 2

I found the answer to what I was looking for by using UrlReferrer. See below.

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Request.UrlReferrer.ToString <> "" Then
        Session("PageUrl") = Request.UrlReferrer.ToString
    End If
 End Sub

OTHER TIPS

I don´t understand completely what do you mean with

"how can I get the url requested my page"

you may have the case to set your page as public or cange the login url to the page you need

<authentication mode="Forms">
  <forms loginUrl="your_page.aspx"
    defaultUrl="index.aspx" />
</authentication>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top