My ASP.Net site works perfectly in local network. But after uploading in the net, session times out frequently.
I have 2 session variable.One is declared ( CompanyTitle) at Global.asax(Session_Start event), another in login page ( userName). The session variable declared in Global.asax is available in all pages, the other variable is not. It gives an error as "Object variable is not set to an instance.....". After that I declared this variable in Global.asax(Session_Start event) with "" as its default value. Now the problem is that the UserName session variable is reset into "" frequently.
my session entry in web.config is as
Please advice me on this problem.
Mohan Kumar RajasekaranPosted Apr 17, 2009, 5:17 AM
Maximum no of worker processess value should be set to 1
The session value in the InProc mode session state will not be persisted if the application is deployed in a application pool with the Maximum no of worker processess value greater than 1.
Nipun TomarPosted Apr 13, 2009, 5:36 AM
First - increase the timeout in web.config
<sessionState mode="InProc" cookieless="UseCookies" timeout="60" >
Second- Change the time-outs in IIS. Choose a value greater than the value you require. (The default session time-out setting on IIS is 20 minutes but it can be increased to a maximum of 24 hours or 1440 minutes)
1.Select your Web Site > Properties > Home Directory > Application Settings > Configuration > Options
2.Enable the session state time-out and set the Session timeout greater than you set in web.config
Third- Increase application pool's Idle timeout
1.Application Pools > yourAppPool > Properties > Performance
2.Under Idle timeout, set Shutdown worker processes after being idle for a value higher than you set in web.config.
Fourth- increase the FormAuthenticationTicket time
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, // Ticket version
.
.
DateTime.Now.AddMinutes(60), // Date/time to expire
.
.);