检索没有 [key]= 部分的 ASP.NET cookie
Retrieve an ASP.NET cookie without the [key]= part
我有一个 ASP.NET cookie,我是这样设置的:
string identifier = Guid.NewGuid().ToString();
HttpCookie dateCookie = new HttpCookie("identifier");
dateCookie.Values.Add("identifier", identifier);
dateCookie.Expires = DateTime.Now.AddHours(12);
Response.Cookies.Add(dateCookie);
然后我这样检索它:
string cookievalue = Request.Cookies["identifier"].Value;
cookievalue 现在有这个值:
identifier=79976995-468a-4ff0-b259-9686c487f9d5
如何检索 cookie 以便我只得到:
79976995-468a-4ff0-b259-9686c487f9d5
string strcookie=cookievalue.Split('=')[1];
希望你能理解它对你有用。
我有一个 ASP.NET cookie,我是这样设置的:
string identifier = Guid.NewGuid().ToString();
HttpCookie dateCookie = new HttpCookie("identifier");
dateCookie.Values.Add("identifier", identifier);
dateCookie.Expires = DateTime.Now.AddHours(12);
Response.Cookies.Add(dateCookie);
然后我这样检索它:
string cookievalue = Request.Cookies["identifier"].Value;
cookievalue 现在有这个值:
identifier=79976995-468a-4ff0-b259-9686c487f9d5
如何检索 cookie 以便我只得到:
79976995-468a-4ff0-b259-9686c487f9d5
string strcookie=cookievalue.Split('=')[1];
希望你能理解它对你有用。