Encodes a cookie with All protection levels
| C# | Visual Basic | Visual C++ |
public static HttpCookie Encode( HttpCookie cookie )
Public Shared Function Encode ( _ cookie As HttpCookie _ ) As HttpCookie
public: static HttpCookie^ Encode( HttpCookie^ cookie )
- cookie (HttpCookie)
- An object of type HttpCookie to encode.
An object of type HttpCookie encoded and tamper proof.
The following C# example demonstrates how to Encode a cookie.
CopyC#
//Create a value to store string myValueToStoreInCookie = "My details"; //Create a "standard" (unencrypted) HttpCookie HttpCookie myCookie = new HttpCookie("MyCookieName",myValueToStoreInCookie); //encrypt the "standard" cookie HttpCookie myEncodedCookie = Rolosoft.WebControls.CookieSecure.Encode(myCookie); //Add the encoded cookie to the response stream. Page.Response.AppendCookie(myEncodedCookie);
| Exception | Condition |
|---|---|
| CookieSecureException | Thrown if cookie is invalid or tamper is detected. |