3 February 2014

Custom Mode -Sessions

       Custom mode specifies that you want to store session state data using a custom session state store provider. When you configure your ASP.NET application with a Mode of Custom, you must specify the type of the session state store provider using the provider’s sub-element of

        The session State configuration element. You specify the provider type using an add sub-element and include both a type attribute that specifies the provider's type name and a name attribute that specifies the provider instance name.

         The name of the provider instance is then supplied to the custom Provider attribute of the session State element to configure ASP.NET session state to use that provider instance for storing and retrieving session data

Implementation of Custom Mode:

<Configuration>
  <ConnectionStrings>
    <add name="OdbcSessionServices"
      ConnectionString="DSN=SessionState;" />
  </connectionStrings>
  <system.web>
    <sessionState
      mode="Custom"
      customProvider="OdbcSessionProvider">
      <providers>
        <add name="OdbcSessionProvider"
          type="Samples.AspNet.Session.OdbcSessionStateStore"
          connectionStringName="OdbcSessionServices"
          WriteExceptionsToEventLog="false" />
      </providers>
    </sessionState>
  </system.web>
</configuration>

No comments:

Post a Comment