kaushik kaushik - 3 months ago 17
ASP.NET (C#) Question

How To read cookie which created from client side javascript in serverside asp.net code

For Example I have put one cookie on page load with some specific value on button submit at server side c# code how do i get the value of that cookie ?(asp.net)

Answer

Reading Cookie:

if (Request.Cookies["NameofCookie"] != null)
{
    string value = string.Empty;
    if (Request.Cookies["NameofCookie"]["yourkey"] != null)
    { value= Request.Cookies["NameofCookie"]["yourkey"]; }
}
Comments