CookieExtensionsAddCookie Method (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.
Namespace:
NetQuarry.Net
Assembly:
EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax public static void AddCookie(
this HttpResponse response,
string name,
string value,
CookieAttrs attrs,
string domain = null,
int expiresDays = 0
)
<ExtensionAttribute>
Public Shared Sub AddCookie (
response As HttpResponse,
name As String,
value As String,
attrs As CookieAttrs,
Optional domain As String = Nothing,
Optional expiresDays As Integer = 0
)
Parameters
- response
- Type: System.WebHttpResponse
The response. - name
- Type: SystemString
The cookie name. - value
- Type: SystemString
The cookie value. - attrs
- Type: NetQuarry.NetCookieAttrs
Attributes affecting cookie creation (e.g. Encoded, Secure). - domain (Optional)
- Type: SystemString
The optional cookie domain. - expiresDays (Optional)
- Type: SystemInt32
The optional cookie expiration, in days from the current date. This is set on the cookie only if non-zero.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
HttpResponse. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks See Also