Notaras
Notaras

Reputation: 717

Debugging C# MVC3 in visual studio : can i stop session data from clearing each time i re-start debugging?

Each time when I stop debugging on localhost and start again, session data gets cleared. So, I have to log- out and log-in again to reach same point. This has become a pain because I have to go through the whole log-in process to reach the page that I was working on.

Any help on this is much appreciated.

Upvotes: 1

Views: 385

Answers (1)

mccee
mccee

Reputation: 1667

If you're using InProc session state management (the default), then you're going to be out of luck. Whenever the IIS worker process restarts (when you start debugging), the session state is cleared. The advantage to InProc, of course, is that it runs in memory, so it's faster.

However, you could switch to using a state server or a database to manage the sessions. Those both run out-of-process, meaning they don't get cleared when IIS restarts, or when you start debugging.

Or perhaps, an alternative could be to use the #if DEBUG directive to hard-code and pre-populate a username and password during the login process? That could at least save typing time :)

Upvotes: 1

Related Questions