I have an ASP.NET web forms application (not MVC) set up utilising routes which are defined in my Global.asax file like so;
routes.Add("Login", New Route("login", New CustomRouteHandler("~/authenticate.aspx")))
routes.Add("AdditionalInfo", New Route("additional-information", New CustomRouteHandler("~/secure/additionalInfo.aspx")))
At points throughout the application it is a requirement that the user be authenticated which would simply redirect them to the login screen.
The problem I have is how would I then redirect them back to the point where authentication was required? With bog standard url's i would do something like;
http://www.site.com/login.aspx?returnURL=someReturnURL
Is it even possible with routes in web forms?
Retrieve the QueryString Parameter on Page_Load Event & save it in
ViewState["returnURL"] = Request.QueryString["returnURL"];
Then, in button click event do the redirection on successfull authentication:
Response.Redirect(ViewState["returnURL"].ToString());