Click here to Skip to main content
15,907,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to redirect the user to the login.aspx page after the expiration of session.means after session timeout.how it can possible plz tell me sir.........
Posted

Use the setting in web.config file as shown:

XML
<authentication mode="Forms">
     <forms cookieless="UseCookies" defaultUrl="HomePage.aspx"
    loginUrl="UnAuthorized.aspx" protection="All" timeout="30">
          </forms>
</authentication>


In the above code use cookieless and time out attribute to get your recruitment.
Read complete article:
ASP.NET Membership and Role Provider[^]
 
Share this answer
 
Comments
Member 8387468 7-Dec-11 6:01am    
sir i want that after the timeout of session it should not show exception of 'object set to an instance of null exceptions' infect it should automatically redirect to the login page how it can possible?
 
Share this answer
 
Comments
Member 8387468 7-Dec-11 6:02am    
sir i want that after the timeout of session it should not show exception of 'object set to an instance of null exceptions' infect it should automatically redirect to the login page how it can possible?
In your Global.asax, insert the code below.

C#
void Session_End(object sender, EventArgs e)
{
   Response.Redirect("Login.aspx");
}


Regards,
Eduard
 
Share this answer
 
Comments
Member 8387468 7-Dec-11 6:02am    
where should i use this method?
Member 8387468 7-Dec-11 6:03am    
i mean where will i use this method?at master page or loginpage ...?
[no name] 7-Dec-11 6:08am    
in Global.asax :)
Member 8387468 7-Dec-11 6:17am    
so after declaring it global.asax class is it called itself or i have to call it by making its object on master page?
plz reply
[no name] 7-Dec-11 20:14pm    
no need sir. just put the response.redirect inside the curly braces. The Event Session_End is already there by default =)
hi check this code

it will help you

http://devnet.asna.com/KB/Pages/397.aspx[^]

don't forget to vote :)
 
Share this answer
 
Comments
Member 8387468 7-Dec-11 5:37am    
sir i m not getting this code plz tell me this in asp.net using C#
Member 8387468 7-Dec-11 6:02am    
sir i want that after the timeout of session it should not show exception of 'object set to an instance of null exceptions' infect it should automatically redirect to the login page how it can possible?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900