[求助]WinForm访问网页
访问网页A,成功访问后会网页A会设置几个COOKIE,然后网页自动跳转到网页B网页B需要上面设置的COOKIES才能正常访问,结果可能因为COOKIE设置不对不能成功访问网页B
下面是我的实现代码,请大侠们指教原因,谢谢!
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(A);
CookieContainer cc = new CookieContainer();
req.CookieContainer = cc;
req.Method = "GET";
req.KeepAlive = true;
HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
foreach(Cookie cook in rsp.Cookies){cc.Add(cook);}
红色语句是出现异常的地方,网页B访问禁止(异常码:403)
[[it] 本帖最后由 vcn001 于 2008-11-21 16:42 编辑 [/it]]