ASP.NET session state supports different storage options for session data: InProc mode, StateServer mode, SQLServer mode, Custom mode and Off mode. In this article I will give you an step-by-step guide on how to use InProc Session State Mode in your ASP applications.
What is InProc Session State Mode and Why is useful for my ASP hosting account?
In-proccess mode stores session state in memory on the Web server and is the default session state mode. In-process mode stores session state values and variables in memory on the local Web server. It is the only mode that supports the Session_OnEnd event. InProc Session State is much much faster, has less requirements (serialization), and it is better than SQL Sessions, which generate significant server overhead.
You can set the InProc Session State Mode and session timeout in the Web.Config file of you application like this:
<configuration> <system.web> <sessionState mode="InProc" timeout="25"></sessionState> </system.web> </configuration>
InProc Session State Mode is easy to implement and it stores the session data on the server very fast, but when the application domain or worker process restart, the session data will be lost and if you have more session data, means more memory used in the web server and that could affect the performance of your web application.
In conclusion, InProc Session State mode is a process of fast storage, but you should use in small applications, because the session data will be lost if the server is restart or if the application domain is recycled.
This concludes InProc Session State Mode in ASP.Net.