locked
check if cookie exists ? RRS feed

  • Question

  • User1097391149 posted

    I have a smilar problem.

    I create a cookie after that reload page and load the page with the options written in the cookie but when the first time the page is called there is no cookie because I havent created it yet so I have to check if the cookie exists if it doesnt I create a cookie with a default settings.

    The code below is in my Global.asax

    if (HttpContext.Current.Request.Cookies["modele"] != null)
    {
        // do something
       string cookietext = HttpContext.Current.Request.Cookies["modele"].ToString();
    }
    



    i get [HttpException (0x80004005): Request is not available in this context]

    Maybe i need to check if it's the first time user visited the page instead of checking the cookie

    Any ideas ?

    Sunday, December 30, 2012 7:16 PM

Answers

All replies