Advertise with us

How to get the cookie value in asp.net

Posted by  marcel ethan
 1541  View(s)
Ratings:
Rate this:

I am creating a cookie and storing the value of username after succesfull login. How can I access the cookie when the website is opened. If the cookie exist I want to fill the username text box from the cookie value. And how to decrypt the value to get the username. I am doing server side validation by getting the userdetails from the database.

I am using vs 2010 with c#

  1. Re: How to get the cookie value in asp.net

    Hi marcel, 


    You may use Request.Cookies collection to read the cookies.

    if(Request.Cookies["key"]!=null)
    {
       var value=Request.Cookies["key"].Value;
    }

      Modified On Apr-05-2018 03:48:57 AM

Answer