httpCookies Element (ASP.NET Settings Schema)

Configures properties for cookies used by a Web application.

<httpCookies domain="String" 
             requireSSL="true|false" />

The following sections describe attributes, child elements, and parent elements.


Attribute Description


Optional String attribute.

Sets the cookie domain name.


Optional Boolean attribute.

Enables output of the HttpOnlyCookies cookie in Internet Explorer 6 SP1.

Default value is false.


Optional Boolean attribute.

Sets a value indicating whether Secure Sockets Layer (SSL) communication is required.

Default value is false.


This setting is overridden by any other feature that exposes the requireSSL configuration (for example: the forms Element for authentication (ASP.NET Settings Schema)).

Child Elements


Parent Elements

Element Description


The required root element in every configuration file used by the common language runtime and .NET Framework applications.


Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

Internet Explorer added support in Internet Explorer 6 SP1 for a cookie property called HttpOnlyCookies that can help mitigate cross-site scripting threats that result in stolen cookies. When a cookie that has HttpOnlyCookies set to true is received by a compliant browser, it is inaccessible to client-side script. For more information on possible attacks and how this cookie property can help mitigate them, please see Mitigating Cross-Site Scripting with HTTP-Only Cookies tutorial on MSDN.

The following default httpCookies element is not explicitly configured in the machine configuration file or in the root Web.config file, but is the default configuration returned by an application in the .NET Framework version 2.0.

<httpCookies httpOnlyCookies="false" 
  domain="" />

The following example configures cookies for an ASP.NET application.

<httpCookies httpOnlyCookies="false" 
  requireSSL="false" />

Configuration Section Handler


Configuration Member


Configurable Locations


Root level Web.config

Application level Web.config

Virtual or physical directory level Web.config


IIS version 5.0, IIS version 5.1, or IIS version 6.0

.NET Framework version 1.0, .NET Framework 1.1, or .NET Framework 2.0

Visual Studio 2003, or Visual Studio 2005

Community Additions