问大神们一个问题,我把cookless设置为true了,现在sessionID存在URL里面了,可是为什么刷新页面这个sessionID都会变呢,不是说一个会话的sessionID是不变的吗
可能是没有在Session里面保存任何信息引起的,即程序中任何地方都没有使用Session。当Session中保存信息之后SessionID将一直和浏览器相关,此时的SessionID将不会在变化。
要使用过session后才会保持一致。。
When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application's Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object.
http://stackoverflow.com/questions/2874078/asp-net-session-sessionid-changes-between-requests