Asp.net sessions are lost when the page reloads (ispostback = false)

I have a really weird problem with session variables.

I have an asp.net page that sets several session variables. On my development machine (localhost), I am posting back and the session values ​​are still populated.

When I reload the page by clicking on the url line and pressing Enter, session variables still exist.

However, when I deploy this page to the web server, the page still saves the session values ​​when posting back, but as soon as I click on the URL and press Enter, the session values ​​are lost (where ispostback = false)

But when I click the refresh button, there are session variables (but I get a pop-up window warning me that these pages should be outraged!)

I am running IE 7 and the iis6 web server, what am I doing wrong ?!

please help x

+4
source share
2 answers

Which session state provider are you using? By default, InProc is used, with sessions stored in the asp.net workflow. This means that session state may be lost if the application pool is restarted or there is not enough memory on the server. You can try using StateServer mode, in which sessions are stored in a separate service running on the server. You can change the mode in web.config for example.

 <system.web> <sessionState mode="StateServer" /> </system.web> 

See http://support.microsoft.com/kb/307598

+2
source

It appears that the web server is not configured to use session state.

Make sure your web.config has the correct <sessionState> section, with mode located in InProc :

 <sessionState mode="InProc" /> 
+1
source

Source: https://habr.com/ru/post/1302596/


All Articles