Decodes a cookie from definable protection level.
| C# | Visual Basic | Visual C++ |
public static HttpCookie Decode( HttpCookie cookie, CookieProtection cookieProtection )
Public Shared Function Decode ( _ cookie As HttpCookie, _ cookieProtection As CookieProtection _ ) As HttpCookie
public: static HttpCookie^ Decode( HttpCookie^ cookie, CookieProtection cookieProtection )
- cookie (HttpCookie)
- The encoded cookie to decode of type HttpCookie.
- cookieProtection (CookieProtection)
- An enumeration of type CookieProtection defining the level of protection to use when decoding the cookie.
An object of type HttpCookie which is the decoded cookie.
The following C# example shows how to decode a cookie that has been encoded using "Encryption" only.
CopyC#
HttpCookie standardCookie = Request.Cookies["MyCookieName"]; if(standardCookie!=null) { HttpCookie decodedCookie = Rolosoft.WebControls.CookieSecure.Decode(standardCookie,System.Web.Security.CookieProtection.Encryption); //...Go on to process decoded cookie }
| Exception | Condition |
|---|---|
| CookieSecureException | Thrown if cookie is invalid or tampered. |