开发者

ASP.NET Request.Cookies["ASP.NET_SessionId"] vs SessionId

开发者 https://www.devze.com 2022-12-16 02:16 出处:网络
What is the difference between: HttpContext.Current.Request.Cookies[\"ASP.NET开发者_StackOverflow_SessionId\"].Value
  1. What is the difference between:

    HttpContext.Current.Request.Cookies["ASP.NET开发者_StackOverflow_SessionId"].Value

and

System.Web.SessionState.HttpSessionState.SessionId

(while debugging, both of the values were always the same)


Well there exists more than one method of how ASP.NET handles a session. It's configurable by the web.config for example.

One of them is by cookies. Another one is by putting the session ID inside of the url. I boldly presume you won't be able to find the session ID in the cookie collection in that second case.


ASP.Net uses that cookie to track the session across requests. They will always be the same value. For more details: http://msdn.microsoft.com/en-us/library/ms178581.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消