0

如何在 VS2010 中调试时检查收到的所有 cookie....

                CookieContainer cookiejar = new CookieContainer();
                webRequest.Method = "POST";
                webRequest.Host = "www.site.com";
                webRequest.ContentType = "application/x-www-form-urlencoded";
                webRequest.UserAgent = "~~~~";
                webRequest.Accept ="~~~~";
                webRequest.Referer = "http://www.site.com";
                webRequest.CookieContainer = cookiejar;  
                HttpWebResponse webresponse =  (HttpWebResponse)webRequest.GetResponse();

cookiejar <=显示 6 个 cookie 的计数 ..但我在其中找不到任何 cookie 值。

4

1 回答 1

0

用这个-

if(Request.Cookies["key"]!=null)
{
   var value=Request.Cookies["key"].Value;
}

如果不起作用,请检查大写/小写

于 2013-02-21T14:06:52.180 回答