Click here to Skip to main content
14,698,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I write a following code in web.config file to increased a timeout of session
<sessionstate mode="InProc" timeout="120"/>

but it is not work most of time.
After uploading website on server it is not at all work.
I search of internet but it seen that it is a problem generally occurred with session mode="InProc" please help.

What I have tried:

I write a following code in web.config file to increased a timeout of session
<sessionstate mode="InProc" timeout="120"/>
Posted
Updated 27-Jun-16 9:36am
v2
Comments
Kornfeld Eliyahu Peter 27-Jun-16 9:48am
   
How do you know it is not working? You have waited there for two hours and more to check?
Kishor-KW 27-Jun-16 9:54am
   
yes i did BTW session is out after 15 mint. instead i gave time of 2 hour
TheKarateKid 27-Jun-16 10:14am
   
is there any way that you have session setting in IIS which is less than 120 ?
Member 12599256 27-Jun-16 10:43am
   
http://stackoverflow.com/questions/1205828/how-to-set-session-timeout-in-web-config
ZurdoDev 27-Jun-16 11:32am
   
Some things that may be affecting it. Your idle timeout on the app pool in IIS may be causing it. If you have code that is changing web.config your sessions will get reset. If you are putting new code in place you'll also lose your sessions.
Richard Deeming 27-Jun-16 14:31pm
   
That looks like the answer to me. :)

1 solution

As mentioned in the comments, there are several things that can cause sessions to get lost. Your idle timeout on the app pool in IIS may be causing it. If you have code that is changing web.config your sessions will get reset. If you are putting new code in place you'll also lose your sessions.

You'll need to troubleshoot why your session is getting reset. I'd also like to hear why you think the session is being reset.
   
Comments
Kishor-KW 30-Jun-16 7:14am
   
but what is role of IIS after hosting web-site on other server. IIS is a Local server am I right?
ZurdoDev 30-Jun-16 8:16am
   
What role? I'm not sure what you are asking.
Kishor-KW 30-Jun-16 9:24am
   
i mean there is no iis server at hosted server. IIS server is one on which we run our website developed in Visual studio. Is IIS server like wamp server ?
ZurdoDev 30-Jun-16 10:13am
   
If your hoster does not have IIS, how are they hosting your site? You need IIS to host ASP.Net sites.
Kishor-KW 30-Jun-16 13:17pm
   
okk.Thank you for sort out my confusion. So I have to contact to my hoster to changes settiong of IIS to increase time of session
ZurdoDev 30-Jun-16 13:20pm
   
It depends. I still want to know what makes you think the session has ended.

IIS has an idle timeout setting. I think it defaults to 15 minutes or so. It means that if no one accesses the site for that amount of time, the application shuts down. So, if you are testing with just one user this may be the issue.
Kishor-KW 30-Jun-16 13:45pm
   
I get know how session is out because of I maintain some session variables for passing variable from one page to other. and when session variable is null then i navigate page to login page. thats how i get know session is out. and yes it is probably happen after 15 min as you said it is time for iis. I thought asp.net default session time is 20 min.
ZurdoDev 30-Jun-16 14:10pm
   
Session time is 20 minutes. Idle time is a different setting in IIS.
Kishor-KW 30-Jun-16 14:49pm
   
ok. so now i have to contact with hoster to increase session?
ZurdoDev 30-Jun-16 15:02pm
   
Yes, increase idle time.

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