有没有办法在 ASHX Handler 中检索 cookie 值?
我在页面中设置了一个 cookie,我想在我的 ashx 中检索它。我的 cookie 始终为空。
我像这样保存我的cookie
HttpCookie tokenCookie = new HttpCookie(cookieName);
tokenCookie.Values["siteGuid"] = authenticationInfo.SiteGuid.ToString();
HttpContext.Current.Response.Cookies.Add(tokenCookie);
我像这样检索我的cookie
HttpCookie cookie = HttpContext.Current.Request.Cookies[cookieName];
return new Guid(cookie["siteGuid"]);
好吧,对不起,那是我的错。我的处理程序在一个子域上。