views:

90

answers:

1

Every now and then when I am running/debugging an ASP.NET MVC website through Visual Studio and if I am changing some CSS or HTML in a View while the project is still running, the Session will drop intermittently.

I have confirmed this in the Global.asax adding a Session_End method and setting a break point inside it. As soon as I click Save All through Visual Studio after about 10 or so minutes Session_End is called. I don't even have to refresh the actual page which I think is a little bizarre...

I realize that recompiling the app would cause the session to be lost, but I would not think modifying a View while the application is running would cause this.

Any thoughts on why this could possibly be happening?

+1  A: 

Since you are clicking Save All, is it possible that you've also modified a code file or the web.config as well. Any sort of change -- even if you removed it -- would make the file dirty and cause it to be saved as well. This may cause the behavior you are talking about.

You might want to think about using SQL for session state in your development environment. I recently switched to this (because I needed to for our production environment) and no longer see that sort of behavior even when I stop debugging and recompile the application. As long as the session cookie is still valid, it is able to pull my session information from the database.

tvanfosson
I am not changing any CS or Config files, simply ASPX Views. Is there anything else that might be causing this? Why would Session_End be called just by clicking Save All?
aherrick