Click here to Skip to main content
15,849,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m having problem with my web application where i set the form timeout to 15 mins (this is when no activity from user) and session ends after 15 minutes as well (session state timeout i set to 15 mins in web.config)

But even there's activity,it automatically redirects me to login page.

Any ideas guys how to overcome this issue?
sahabiswarup 8-Dec-11 0:16am    
can you please show me the code what type of logic you are exactly using.


If you have a master page then put the trapping in
masterpage code behind.

Example code:

In you login page code behind should content
Session["UserId"] = user.UserId;

protected void Page_Load(object sender, EventArgs e)
        ClientScriptManager s = Page.ClientScript;
        if (!IsPostBack)
            txtUserId.Text = Session["UserId"];
            // ...
            if (txtUserId.Text == string.Empty)
           //... Some code here?
        //... some code here?

If ever the session expire, the Session["UserId"] automaticaly
should contents empty, therefore redirecting to login page...

Hope this could help...

Do not forget to vote if could help...

Share this answer
pwtc222 8-Dec-11 1:54am    
i found that even i set the sessionstate for 1440mins,but the session expires in 15 this could happen?
Al Moje 8-Dec-11 3:59am    
You may combined ViewState within Session. Advise you to know the usages of these two. Such as there deferences...
Please check GLOBAL.asax is there any redirection code in SESSION_ONEND EVENT, remove it
Share this answer

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