2009-09-10 20 views
0

現在我需要將內容保存到一個asp.net程序的Session對象中,並且當我將某些東西保存到會話對象中時,asp.net將生成一個包含ASP.NET_SessionId =「當前會話ID」的cookie。如何解決在asp.net中修復的會話?

這將導致會話固定安全問題。 誰能幫我解決這個問題?

回答

0

您可以關閉客戶端Cookie並讓服務器處理它。這會給你的服務器帶來更大的壓力,但它很容易通過你的web.config進行配置。只需閱讀會話配置。

<sessionState 
    mode="[Off|InProc|StateServer|SQLServer|Custom]" 
    timeout="number of minutes" 
    cookieName="session identifier cookie name" 
    cookieless= 
     "[true|false|AutoDetect|UseCookies|UseUri|UseDeviceProfile]" 
    regenerateExpiredSessionId="[True|False]" 
    sqlConnectionString="sql connection string" 
    sqlCommandTimeout="number of seconds" 
    allowCustomSqlDatabase="[True|False]" 
    useHostingIdentity="[True|False]" 
    stateConnectionString="tcpip=server:port" 
    stateNetworkTimeout="number of seconds" 
    customProvider="custom provider name"> 
    <providers>...</providers> 
</sessionState>