Tuesday, November 20, 2007

asp.net membership returnURL & DestinationPageUrl

I have recently been having issues with my web application where we don't want the user redirected to the URL they were on after their session times out. Unfortunately I couldn't find anything that would turn off this functionality in Microsoft's membership block.

I read both of these pages which gave great information except that they didn't work for me:
http://msdn2.microsoft.com/en-us/library/aa480476.aspx
http://msdn2.microsoft.com/EN-US/library/ms178331.aspx

In the end I created my own solution by putting the following code into the Page_Load method:
[code]
if (Request.QueryString.Get("ReturnURL") != "" && Request.QueryString.Get("ReturnURL") != null) Response.Redirect("~/login.aspx");
[/code]

No comments: