i want to know in forms authentication after session timed out page should redirt to lo login page and afetr logged in it should redirect to old page, ex : - i am working in f.aspx after session timed out it should
redirect to login.aspx then after logged in it should redirect to f.aspx
that return url, returns the presentpage url,can u explain clearly
If you use the sections I have above in the web.config and the login page, you will get the following URL if you attempt to go to a page that is only accessible once logged in...
You also need to set up each of the folders or pages in the authorize section of web.config
sureshadhi.n...
0 Points
4 Posts
While Session Timed Out Return to login page
May 21, 2012 02:04 PM|LINK
Hi Microsoft Support Team,
i want to know in forms authentication after session timed out page should redirt to lo login page and afetr logged in it should redirect to old page, ex : - i am working in f.aspx after session timed out it should redirect to login.aspx then after logged in it should redirect to f.aspx
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: While Session Timed Out Return to login page
May 21, 2012 04:24 PM|LINK
when the session time and redirect to login.aspx then add querystring goto=/path/to/redirect/aftr/login
then after login check whether if(!string.IsNullOrEmpty(Request.QueryString["goto"]) { Response.Redirect(Request.QueryString["goto"])}
else { Response.Redirect("dashboard.aspx"); }
christiandev
Star
8607 Points
1841 Posts
Re: While Session Timed Out Return to login page
May 21, 2012 04:51 PM|LINK
Web.config
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="homePage.aspx" timeout="nnnn" name="UserLogin" path="/"/>
</authentication>
login.aspx.cs
FormsAuthentication.RedirectFromLoginPage(username, persistent cookie?)
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: While Session Timed Out Return to login page
May 21, 2012 05:25 PM|LINK
Forms authentication already has a query string parameter returnUrl please check this after login success and redirect
sureshadhi.n...
0 Points
4 Posts
Re: While Session Timed Out Return to login page
May 22, 2012 07:19 AM|LINK
that return url, returns the presentpage url,can u explain clearly
sureshadhi.n...
0 Points
4 Posts
Re: While Session Timed Out Return to login page
May 22, 2012 07:22 AM|LINK
can u explain brefily wher to i add querystring
amit.jain
Star
11225 Points
1815 Posts
Re: While Session Timed Out Return to login page
May 22, 2012 07:36 AM|LINK
refer http://csharpdotnetfreak.blogspot.com/2009/01/forms-authentication-aspnet-20.html
http://csharpdotnetfreak.blogspot.com/2008/11/detecting-session-timeout-and-redirect.html
amiT jaiN
ASP.NET C# VB Articles And Code Examples
christiandev
Star
8607 Points
1841 Posts
Re: While Session Timed Out Return to login page
May 22, 2012 07:46 AM|LINK
If you use the sections I have above in the web.config and the login page, you will get the following URL if you attempt to go to a page that is only accessible once logged in...
You also need to set up each of the folders or pages in the authorize section of web.config
http://www.yoursite.com/index.aspx?ReturnUrl=%2fsecurePage.aspx
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)