2012-07-16 114 views
0

在我的asp.net aplication我在web.config中使用這些設置會話cookie和asp.net

<sessionState mode="InProc" 
       stateConnectionString="tcpip=127.0.0.1:42424" 
       stateNetworkTimeout="10" 
       sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI" 
       sqlCommandTimeout="30" customProvider="" cookieless="UseCookies" 
       cookieName="ASP.NET_SessionId" 
       timeout="120" 
       allowCustomSqlDatabase="false" 
       regenerateExpiredSessionId="true" 
       partitionResolverType="" 
       useHostingIdentity="true"> 
    <providers> 
    <clear/> 
    </providers> 
</sessionState> 

<authentication mode="Forms"> 
    <forms loginUrl="~/login.aspx" 
     defaultUrl="Default.aspx" 
     cookieless="UseCookies"/> 
</authentication> 

但有時會站在行爲怪異

得到用戶http://my.appl.com/S(DGsdgfg453dsgfsdgsdgsd)/mypage.html 其中S(DGsdgfg453dsgfsdgsdgsd)用於一個用戶的會話密鑰,但讓他所有的用戶。好像UseCookies = false.

我重新啓動應用程序,並有一段時間它工作良好。然後再一次。

我的應用程序有什麼問題?

+0

」節點中「無cookie」的值爲「true」或「false」,而不是「UseCookies」。 – 2012-07-16 12:31:27

+0

不僅http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx – 2012-07-16 12:53:09

+0

和我用「假」沒有好結果 – 2012-07-16 12:56:39

回答

0

我想是因爲內存已滿。我在Session中保留了一個很大的序列化對象。

我的Global.asax.cs

protected void Session_End(object sender, EventArgs e) 
{ 
Session.Clear(); //? 
Session.Abandon(); 
} 

添加和問題就消失了。