Alexander Trauzzi
Alexander Trauzzi

Reputation: 7396

Where are sessions stored in ASP.net MVC 5 applications?

I'm working on an ASP.net 4 web application using MVC5. I'm curious as to where sessions are stored in the default application scaffold running locally and whether there's any configuration available.

Upvotes: 1

Views: 4665

Answers (1)

Aristos
Aristos

Reputation: 66641

The session is configured on web.config. By default is saved on memory and a service that runs on server is handle that. Other way is to save it on a database...

This is the Session-State Modes... from MSDN:

InProc mode, which stores session state in memory on the Web server. This is the default.

StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. Custom mode, which enables you to specify a custom storage provider.

Off mode, which disables session state.

Upvotes: 6

Related Questions