Click or drag to resize

CookieExtensions Class

Helper methods for working with HttpCookies.
Inheritance Hierarchy
SystemObject
  NetQuarry.NetCookieExtensions

Namespace:  NetQuarry.Net
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public static class CookieExtensions

The CookieExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAddCookie(HttpResponse, HttpCookie, String)
Add a cookie to the response.
Public methodStatic memberAddCookie(HttpResponse, String, String, String, Int32)
Create a cookie and add it to the response. Note that you should use AddCookie(HttpResponse, String, String, CookieAttrs, String, Int32) if the cookie should be Secure or if the cookie value might contain characters invalid in a cookie value.
Public methodStatic memberAddCookie(HttpResponse, String, String, CookieAttrs, String, Int32)
Create a cookie and add it to the response. You should specify Encoded if the cookie value might contain characters invalid in a cookie value. Use GetEncodedCookieValue(HttpRequest, String) when retrieving values from encoded cookies. Specify Secure if the cookie should be Secure.
Public methodStatic memberAddEncodedCookie
Create a cookie and add it to the response where the cookie value may contain characters that are invalid in a cookie. Use GetEncodedCookieValue(HttpRequest, String) when retrieving values from such cookies. You can also use the AddCookie(HttpResponse, String, String, CookieAttrs, String, Int32) overload which supports Secure cookies as well as encoding.
Public methodStatic memberCookieExists
Determine if the specified cookie exists in the request. Use HasCookieValue(HttpRequest, String) to test for existence with a non-null/empty value.
Public methodStatic memberGetCookieValue
Gets the value of the specified cookie or an empty string if the cookie is not found.
Public methodStatic memberGetEncodedCookieValue
Gets the value of the specified cookie (or an empty string if the cookie is not found) where the cookie value was encoded due to the possibility of containing characters that are invalid in a cookie. See http://stackoverflow.com/questions/1969232/allowed-characters-in-cookies for a discussion of this. The value is decoded using the .Net HttpUtility.UrlDecode() method which is at least approximately equivalent to the javascript decodeURIComponent() method. Use AddEncodedCookie(HttpResponse, String, String, String, Int32) when adding such cookies.
Public methodStatic memberHasCookieValue
Determine if the specified cookie exists in the request with a non-null/blank value. Use CookieExists(HttpRequest, String) to test for existence regardless of value.
Top
See Also