M B

M B

  • NA
  • 10
  • 24.9k

Read browser cookie using C#.Net,Asp.Net

Apr 15 2016 2:12 AM
Hi Team,
I have a requirement in my application that i need to read a cookie from the browser which is created by the other application.
I am not able to read the cookie value.I used the below code to read all the cookies in browser. But, i couldn't get the cookie that i am looking for.
HttpCookie cookie = Request.Cookies["cookiename"];
//Check to make sure the cookie exists
if (cookie != null)
{
//Write the cookie value
String strCookieValue = cookie.Value.ToString();
//lblCookie.Text = "The cookie contains: " + strCookieValue + "";
}
please Help

Answers (5)