Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Unable to return to the previous page after login

$
0
0

Hello,

I have a link at the top of my master page called "Account". If user not logged in and click on this link, the login page displays for the user to login. However, after the login, the browser won't return to the Account.aspx page. It goes to the default.aspx page. Below is my code in the login page code-behind:

if (!Page.IsPostBack)
            {
                Page.Form.DefaultFocus = LoginUser.FindControl("UserName").ClientID;

                if (Page.Request.UrlReferrer != null)
                {
                    Session["LoginReferrer"] = Page.Request.UrlReferrer.ToString();
                }
            }

The problem here is that "Page.Request.UrlReferrer.ToString()" doesn't hold the url of the Account.aspx but the default.aspx instead.

How do I fix this? Please help out if you can.

Thanks in advance.


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>