Some times, In Web app. we signout or timeout the application redirect us to Login.aspx Page. when we Login again it redirects us to Welcome/default.aspx
But, User get should redirect to that page from which he was redirected to Login.aspx due to signout or timeout.
But, User get should redirect to that page from which he was redirected to Login.aspx due to signout or timeout.
See these Links
- http://forums.asp.net/p/1332207/2675781.aspx
- http://forums.asp.net/t/1250726.aspx
- http://www.velocityreviews.com/forums/t113819-how-to-redirect-to-a-requested-page-instead-of-default-page-after-login.html
- http://www.velocityreviews.com/forums/t90174-how-to-specify-redirect-url-after-login.html
Simple Logic..
When User Timedout and he has to login again.. redirect User with QueryString "ReturnUrl" and Get the Url of the Page when User Timedout or Signout..
and When Login.. Check is there any QueryString or "ReturnUrl" If its null Simply redirect him to Welcome Page if its not Null then Redirect him to that Page.
Login Button Code will be like this its Example..
if (Request.QueryString["ReturnUrl"] != null)
{
Response.Redirect(Request.QueryString["ReturnUrl"].ToString());
}
else
{
Response.Redirect("WelcomePage-OR-HomePage.aspx");
}
Also see
- Page.PreviousPage.ToString(); - http://msdn.microsoft.com/en-us/library/system.web.ui.page.previouspage.aspx
- Request.UrlReferrer.ToString(); - http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx
Good Luck`
0 comments:
Post a Comment