SessionState配置

<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>



下面的默认 sessionState 元素不是在 Machine.config 文件或根 Web.config 文件中显式配置的,而是由应用程序返回的默认配置。



<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="20" 

   allowCustomSqlDatabase="false" 

   regenerateExpiredSessionId="true" 

   partitionResolverType="" 

   useHostingIdentity="true">

   <providers>

      <clear />

   </providers>

</sessionState>



示例:

下面的代码示例演示如何指定多个会话状态配置设置。



<sessionState

   mode="SQLServer"

   cookieless="true"

   sqlConnectionString=" Integrated Security=SSPI;data source=MySqlServer;"

   sqlCommandTimeout="10" />

  </system.web>

</configuration>



http://msdn.microsoft.com/zh-cn/library/h6bb9cz9(VS.80).aspx

你可能感兴趣的:(session)