tags:

views:

106

answers:

1

after Redirection , the Session data is lost???

A: 

thanks your reply. and i found i write somes file to the webapp ,so the session is lost

Your asp.net application is restarting. You are probably writing to a location in the asp.net folder that is causing a recompile of the app / not just a sub folder. One special location is the bin folder, drop the smallest of files in there are you get a recycle (shouldn't have a file in there).

The above can be avoiding by writing to a location outside the asp.net folder. Alternative you can write to a different subfolder at the top level and you shouldn't get a recycle.

Another option is to move the session out of process, by using a different SessionStoreProvider. When using the memory based one, your code shouldn't rely on the session from not being lost, since there are other reasons why an asp.net recycle can occur.


You really need to post more information, the information is Not lost in asp.net MVC2 under normal conditions.

If you are referring to TempData only during for 1 request, it is by design. Its only meant for the very next request.

If its regular session, maybe you have only cookie based session configured in the .config and the browser has blocked the cookie.

Also maybe you are redirecting by using a full url (with http://mydomain) and you are using cookieless (or the browser blocked the cookie and it reverted to cookieless), the use of http://mydomain makes asp.net not to consider it as a request inside the app and doesn't add the session id to the url.

eglasius
thanks your reply. and i found i write somes file to the webapp ,so the session is lost.
fjjiaboming