CookieHandler.Delete Method

Definition

Deletes a cookie.

Overloads

Delete()

Deletes the cookie associated with the current request that has the default name, domain, and path.

Delete(String)

Deletes the cookie associated with the current request that has the specified name and the default domain and path.

Delete(HttpContext)

Deletes the cookie associated with the current request that has the default name, domain, and path.

Delete(String, HttpContext)

Deletes the cookie associated with the specified request that has the specified name and the default domain and path.

Delete(String, String, String, HttpContext)

Deletes the cookie associated with the specified request that has the specified name, path, and domain.

Delete()

Deletes the cookie associated with the current request that has the default name, domain, and path.

C#
public void Delete();

Remarks

The name, domain and path are specified by the Name, Domain, and Path properties. The request is specified by HttpContext.Current

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Delete(String)

Deletes the cookie associated with the current request that has the specified name and the default domain and path.

C#
public void Delete(string name);

Parameters

name
String

The name of the cookie.

Exceptions

name is null or empty.

Remarks

The domain and path are specified by the Domain and Path properties. The request is specified by HttpContext.Current

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Delete(HttpContext)

Deletes the cookie associated with the current request that has the default name, domain, and path.

C#
public void Delete(System.Web.HttpContext context);

Parameters

context
HttpContext

The HttpContext for the request.

Remarks

The name, domain and path are specified by the Name, Domain, and Path properties.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Delete(String, HttpContext)

Deletes the cookie associated with the specified request that has the specified name and the default domain and path.

C#
public void Delete(string name, System.Web.HttpContext context);

Parameters

name
String

The name of the cookie.

context
HttpContext

The HttpContext for the request.

Exceptions

name is null or empty.

Remarks

The domain and path are specified by the Domain and Path properties.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Delete(String, String, String, HttpContext)

Deletes the cookie associated with the specified request that has the specified name, path, and domain.

C#
public void Delete(string name, string path, string domain, System.Web.HttpContext context);

Parameters

name
String

The name of the cookie.

path
String

The path for the cookie.

domain
String

The domain for the cookie.

context
HttpContext

The HttpContext for the request.

Exceptions

name is null or empty.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1