CookieExtensions Methods |
The CookieExtensions type exposes the following members.
Name | Description | |
---|---|---|
AddCookie(HttpResponse, HttpCookie, String) |
Add a cookie to the response.
| |
AddCookie(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.
| |
AddCookie(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.
| |
AddEncodedCookie |
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.
| |
CookieExists |
Determine if the specified cookie exists in the request.
Use HasCookieValue(HttpRequest, String) to test for existence with a non-null/empty value.
| |
GetCookieValue |
Gets the value of the specified cookie or an empty string if the cookie is not found.
| |
GetEncodedCookieValue |
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.
| |
HasCookieValue |
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.
|