ASP.NET Tutorial/Configuration/Session state

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Configuring Session State

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.web>
        <!-- Other settings omitted. -->
        <sessionState
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeout="10"
            sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
            sqlCommandTimeout="30" allowCustomSqlDatabase="false"
            useHostingIdentity="true"
            cookieless="UseCookies" cookieName="ASP.NET_SessionId"
            regenerateExpiredSessionId="false"
            timeout="20"
            customProvider=""
        />
    </system.web>
</configuration>


Set session state to auto dectect

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.ru/.NetConfiguration/v2.0">
  <system.web>
      <sessionState cookieless="AutoDetect"/>
  </system.web>
</configuration>


Set to use URL in case of cookie less

<?xml version="1.0"?>
<configuration>
  <system.web>
    <sessionState cookieless="UseUri"/>
  </system.web>
</configuration>