WEB.Config issue!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I noticed in my wb app whenever I modify my web.config the existing sessions
are getting dropped.

I cant understand why this is happening....
 
The Web Application is restarted whenever a change is made to
web.config i believe.

I believe this means that any information that is stored in Sessions,
Application or Cache is discarded.

If you note events for Session/Application End and Start are probably
are triggered.

Also important to note that any information in the Session or
Application should be deemd unimportant as it can be lost at a moment's
notice. This means that you should have alternate methods of storage
and identifying which information belongs to a session or an
application (depending upon how important the information is)
 
ASP.NET gets reloaded when the config file changes. That might cause it to
release all memory.
 
Your session state by default is being maintained InProc (in memory in the
web application). Once your settings in web.config changes, your running
web applicaiton is no longer consistent with the config settings, so ASP.NET
shuts it down and brings up a new on to replace it (with the current settings).
So, when it shuts down your in memory state (like session state) is lost.

Consider 1) not using session state at all. There are many ways to build
an app, maintain state and not store it in session state. Or 2) Configure
session state to use the StateServer NT Service, which is an out of process
app that holds session state such that the state will survive a application
restart. You can also store this data in SqlServer, but for your needs, I
imagine the StateServer Service is sufficient.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Or 2)
Configure session state to use the StateServer NT Service, which is an
out of process app that holds session state such that the state will
survive a application restart. You can also store this data in
SqlServer, but for your needs, I imagine the StateServer Service is
sufficient.

And, BTW, this is done in web.config under the <sessionState> element:

http://msdn.microsoft.com/library/d...us/cpgenref/html/gngrfsessionstatesection.asp

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Editing your web.config file causes an application restart so ASP.NET
can load the site with your new web.config settings. If you're using
InProc session state, that means your sessions get dropped.

You can move your session state to either the State Server or SQL
Server, which will maintain session information through an application
restart. More information on that here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsessionstate.asp

Your webserver respond slowly on the first page hit after you've edited
the web.config file, since ASP.NET needs to JIT compile your code. It's
a good idea to browse to the site yourself immediately after editing
web.config to trigger this.

- Jon
http://weblogs.asp.net/jgalloway
 
Back
Top