Hi Techies,
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. The cookie is a session cookie which will expires when browser lost the session. I used the below code to read all the cookies in browser. But, i couldn't get the cookie that i am looking for.
Request.ServerVariables["HTTP_COOKIE"];
Please help me in reading the cookie value through .NET application.
Regards,
Vijay Kumar E,
Loading
Abdullah MunshiPosted Jan 23, 2012, 5:08 AM
To create cookie:
HttpCookie cobj = new HttpCookie("MyCookie");
cobj.Expires = DateTime.Now.AddDays(1);
cobj.Value = "aaa";
Response.Cookies.Add(cobj);
To retrive cookie value:
string s= Request.Cookies["MyCookie"].Value.ToString();