문제

Problem: In the ASP.NET Web Forms app Session_ID is different for every single Web request. Related ASP.NET_SessionId cookie is not appearing in the firebug.

While researching I found out that Session Cookie disappears right before PostReleaseRequestState event is fired.

Currently found a solution that customizes session-state module implementation. See SessionStateUtility Class (MSDN). While adopted to the app this sample seems to fix all the known problems but this solution is just not clean enough as for me, isn't it? If so what can be a problem here?

Related config source part looks like:
<sessionState mode="InProc" stateConnectionString="***" sqlConnectionString="***" cookieless="false" timeout="20"/>

Thanks.

도움이 되었습니까?

해결책

As documented in this answer https://stackoverflow.com/a/2874174/741695, ASP .NET does not allocate storage for session data until the session object is used.

In short, you can either implement Session_Start in Global.asax and store some dummy data in the Session object to fix its SessionID or you cna do the same somewhere else in your application code.

Hope this helps.

References:

https://stackoverflow.com/a/2874174/741695

http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.sessionid.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top