In ASP.NET there are following session mode available,
- The In-Process(InProc) Session provider is the fastest method, because of everything stored inside the memory. Session data will be loss if we restart web server or if Worker Process Recycles. You can use in small web application where number of users are less. Do not use InProc in Web Farm.
- In StateServer Session modes Session data maintain by aspnet_state.exe. Its keeps session data out of Web server. So any issue with web server does not affect session data. You need to Serialized object before storing data in StateServer Session. we can use it in web farm also.
- SQLServer Session modes store data in SQL Server, we need to provide the connection string. Here we also need to serialize the data before storing it to session. This is very useful in production environment with web farm mode.
- we can use Custom provider for custom data source or when we need to use some existing table to store session data. We can also create our custom sessionID in Custom mode. But it is not recommended to create your own custom provider. Its recommended to use any third party provider.