Quote:If you are using the Forms Authentication[^] you can use the ReturnUrl querystring in your login page: C# var returnUrl = Request.QueryString["ReturnURL"]; if (string.IsNullOrEmpty(returnUrl)){ returnUrl = "~/"; } Response.Redirect(returnUrl); If you are not using it you should behave as it does: When you redirect the user to the login page add a querystring with the referrer page. C# //**Remember to url encode it!** var returnUrl = Server.UrlEncode(Request.Url.PathAndQuery); Response.Redirect("~/login.aspx?ReturnURL=" + returnUrl);
ReturnUrl
var returnUrl = Request.QueryString["ReturnURL"]; if (string.IsNullOrEmpty(returnUrl)){ returnUrl = "~/"; } Response.Redirect(returnUrl);
//**Remember to url encode it!** var returnUrl = Server.UrlEncode(Request.Url.PathAndQuery); Response.Redirect("~/login.aspx?ReturnURL=" + returnUrl);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)