asp.net.ph

SessionStateSection Class

System.Web.Configuration Namespace


.NET Framework version 2.0

Configures the session state for a Web application.

SessionStateSection Class Members

Collapse   Constructors

Visibility Constructor Parameters
public SessionStateSection ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public AllowCustomSqlDatabase Boolean [ Get , Set ]
public CompressionEnabled Boolean [ Get , Set ]
public Cookieless HttpCookieMode [ Get , Set ]
public CookieName String [ Get , Set ]
public CookieSameSite SameSiteMode [ Get , Set ]
public CustomProvider String [ Get , Set ]
public Mode SessionStateMode [ Get , Set ]
public PartitionResolverType String [ Get , Set ]
public Providers ProviderSettingsCollection [ Get ]
public RegenerateExpiredSessionId Boolean [ Get , Set ]
public SessionIDManagerType String [ Get , Set ]
public SqlCommandTimeout TimeSpan [ Get , Set ]
public SqlConnectionRetryInterval TimeSpan [ Get , Set ]
public SqlConnectionString String [ Get , Set ]
public StateConnectionString String [ Get , Set ]
public StateNetworkTimeout TimeSpan [ Get , Set ]
public Timeout TimeSpan [ Get , Set ]
public UseHostingIdentity Boolean [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected PostDeserialize ( ) Void

Remarks

The SessionStateSection class refers to the element in the Machine.config or Web.config configuration file identified by the sessionState tag.

When a new client begins interacting with a Web application, a session ID is issued and associated with all the subsequent requests from the same client during the time the session is valid. This ID is used to maintain server-side state associated with the client session across requests. The SessionStateSection controls how the ASP.NET application establishes and maintains this association on behalf of each client.

This mechanism is very flexible and gives you the ability to host session-state information out of process and to track state without using cookies, among other things.

Example

This section provides two code examples. The first demonstrates how to specify values declaratively for several attributes of the sessionState section, which can also be accessed as members of the SessionStateSection class. The second demonstrates how to use the T:System.Web.Configuration.SessionStateSection class.

The following configuration file example shows how to specify values declaratively for the sessionState section.

<configuration>
   <system.web>
      <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 = "UseDeviceProfile"
         cookieName = "ASP.NET_SessionId"
         timeout = "20"
         allowCustomSqlDatabase = "False"
         regenerateExpiredSessionId = "False"
         partitionResolverType = ""
         useHostingIdentity = "True">
         <providers>
            <clear />
         </providers>
      </sessionState>
   </system.web>
</configuration>

The following code example demonstrates how to use the T:System.Web.Configuration.SessionStateSection class.

// Get the Web application configuration object.
Configuration configuration = WebConfigurationManager.OpenWebConfiguration ( "/aspnetTest" );

// Get the section related object.
SessionStateSection sessionStateSection = ( SessionStateSection ) configuration.GetSection 
   ( "system.web/sessionState" )
  C# VB

See Also

ASP.NET Configuration   <sessionState> Section Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph