Home > DeveloperSection > Forums > How to get the cookie value in asp.net
marcel ethan
marcel ethan

Total Post:105

Points:735
Posted on    August-25-2014 2:03 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 722  View(s)
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#



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    August-25-2014 2:28 AM

Hi marcel, 

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

if(Request.Cookies["key"]!=null)

{

   var value=Request.Cookies["key"].Value;

}


Don't want to miss updates? Please click the below button!

Follow MindStick