Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 24, 2012 02:26 PM by Shailendra Saxena
Dec 17, 2012 01:49 PM|LINK
In my asp.net application if network disconnected again connecting means session objectes cleared.i want if network disconnected again connecting means need to maintain session data.cokkies i can't use ..plz advice how to maintain session even if network
disconnected stage also.
Dec 17, 2012 01:56 PM|LINK
Session state usually expires after 20 mins. If you are disconnected longer than that you will need to use database session or cookies.
Dec 18, 2012 04:50 AM|LINK
first please try with incresing session timeout in config , if not work then go with below solution
To work around this problem, you can use StateServer or SqlServer session state mode. ASP.NET provides these other approaches for storing session state data. In the StateServer and SqlServer modes, your session state is not stored in the AppDomain
of the Web application.
OutProc Session State
In OutProc Session ,Sessin State is stored In the StateServer and SqlServer modes, your session state is not stored in the AppDomain of the Web application.
1.StateServer: Alternately, StateServer mode uses a stand-alone Microsoft Windows service to store session variables. Because this service is independent of Microsoft Internet Information Server (IIS), it can run on a separate
server. You can use this mode for a load-balancing solution because multiple Web servers can share session variables. Although session variables are not lost if you restart IIS, performance is impacted when you cross process boundaries.
2.SqlServer: If you are greatly concerned about the persistence of session information, you can use SqlServer mode to leverage Microsoft SQL Server to ensure the highest level of reliability. SqlServer mode is similar to out-of-process mode,
except that the session data is maintained in a SQL Server. SqlServer mode also enables you to utilize a state store that is located out of the IIS process and that can be located on the local computer or a remote server.
Dec 18, 2012 08:03 AM|LINK
Network disconnection has nothing to do with session expiry. Session will expire as already said, if there is some period of inactivity .. default is 20 min which you can change. But in a webhosting environment there are many more concerns that can cause
session failure.. that may include..
1.) browser history removed (that means session identification cookie lost and server considered next request as new)
2.) the application pool recycled (due to memory over use, or crash of application)
3.) website recompiled (web.config changed or a new dll uploaded, or code in App_Code changed)
4.) server restart
In a shared hosting enivronment, problems can be even severe.. because normally more than one applications are hosted under one application pool. So sessions behave unexpectedly.
To ensure your session lasts the required time, you should try to use a session storage mechanism that is 'out process' that include 'state serevr' or 'sqlserver'.
This article explains how to store sessions in sql server.
Dec 18, 2012 09:14 AM|LINK
Try uSing Cache like cache["abc"]
Dec 19, 2012 09:05 AM|LINK
So many great posts here.
Please refer the link below, it will give a full knowledge about session to you, the concept, session mode, advantages of session, session and cookie and so on. I think it’s helpful for you to understand your problem better.
Hope it helps you,
Dec 21, 2012 10:56 AM|LINK
As many have mentioned already, there are two main ways you can store your ASP.NET sessions.
You must be saving the variables in InProc.You should save the sessions state OutProc in order to keep the information even if network is disconnected.Now ,There are three options available to you if you want to save your sessions in OutProc.
Someone has already explained the first two.I will explain the last alonf with its benefits and disadvantages of other two.See, when you start saving your sessions in Sql Server, there comes a time when you either start running out of space or your application
performance starts degrading since there are too many simultaneous reads and writes since you would be saving temporary data like sessions in it as well as permanenet data about users.
State server gives you performance boost since its dedicated t storing sessions only and its optimized for it.But there are two main problems that come with it.
Now, Distributed cache.
There are many third-party distributed cache providers which can be plugged with your ASP.NEt applications without the need of any code change.
Dec 24, 2012 02:26 PM|LINK
In this case you can keep outporc Session state e.g .Sql server or State server ..