例如我在页面加载时放了一个cookie,在服务器端的按钮提交上有一些特定的值c#代码我如何获得该cookie的值?(asp.net)
答案 0 :(得分:0)
以下是如何在C#中读取cookie:
string cookieValue = string.Empty;
if (Request.Cookies["cookiename"] != null)
{
cookieValue = Request.Cookies["cookiename"].Value.ToString();
}
答案 1 :(得分:-2)
阅读Cookie:
if (Request.Cookies["NameofCookie"] != null)
{
string value = string.Empty;
if (Request.Cookies["NameofCookie"]["yourkey"] != null)
{ value= Request.Cookies["NameofCookie"]["yourkey"]; }
}