System.Web.Configuration.SessionStateSection.Cookieless Property

Gets or sets a value indicating whether cookies are used to identify client sessions.

Syntax

[System.Configuration.ConfigurationProperty("cookieless")]
public System.Web.HttpCookieMode Cookieless { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

There are two ways that session state can store the unique ID that associates the client with a server session: by storing an HTTP cookie on the client or by encoding the session ID in the URL. Storing the session ID in the cookie is more secure but requires the client browser to support cookies.

For applications that allow clients that do not support cookies, such as a variety of mobile devices, the session ID may be stored in the URL. The URL option has several drawbacks. It requires that the links on the site be relative and that the page be redirected at the beginning of the session with new query-string values, and it exposes the session ID right in the query string, where it can be picked up for use in a security attack.

You are encouraged to use the cookieless mode only if you need to support clients that lack cookie support.

Session state also supports two additional options: System.Web.HttpCookieMode.UseDeviceProfile and System.Web.HttpCookieMode.AutoDetect. The former enables the session-state module to determine what mode (cookie or cookieless) is used on a per-client basis based on the browser capabilities. The System.Web.HttpCookieMode.AutoDetect option performs a handshake with the browser to verify whether a cookie may be stored, and therefore requires an additional request to make the determination. If you need to support cookieless clients, strongly consider using System.Web.HttpCookieMode.UseDeviceProfile to generate cookieless URLs only for clients that require them.

Note:

With UP.Browser 4.1 or UP.Browser 3.2, System.Web.HttpResponse.Redirect(string) always behaves as if the value of the HttpCapabilitiesBase.SupportsRedirectWithCookie property of the System.Web.HttpBrowserCapabilities object is false, unless the SessionStateSection.Cookieless property in the SystemWebSectionGroup.SessionState section of Web.config has been explicitly set to true.

In ASP.NET version 1.1, the options for this setting were true or false, but with ASP.NET 2.0, the choices are expanded, and System.Web.HttpCookieMode.AutoDetect is now the default setting. If your Web application has the SessionStateSection.Cookieless property set to a Boolean value, then System.Web.HttpResponse.Redirect(string) should work as expected for these browsers.

Requirements

Namespace: System.Web.Configuration
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0