Cache, Cookies and Session Variables
Retrieve Information from Cookies

Description
Retrieve Information from Cookies.
Variables
Applies to
Page class
Code
 
/// 
/// This method is called when a page is loaded.
/// 
private void RetrieveCookie_MyPageLoad(object sender, System.EventArgs e) 
{ 
    System.Web.HttpCookie myCookie; 

    // Get information from a cookie.
    myCookie = Request.Cookies["myCookieName"]; 
    if (myCookie != null) 
    { 
    
        // If cookie is not empty, then get its value.
        // myCookie.Value is the value of the cookie.
        string cookieValue = myCookie.Value; 
    } 
}
     
Applies to
CSharpPageConstructor class
Code
 
    // The following line will be inserted inside the
    // constructor for page class.
    this.Load += new System.EventHandler(RetrieveCookie_MyPageLoad);  
     


  Privacy Statement