【发布时间】:2014-10-08 20:52:45
【问题描述】:
在我的程序中,我应该在网站上进行授权,获取授权 cookie 值并将请求发送到页面(page1,其 url 类似于“mysite.com/lots/8188/request/4261/”),将我重定向到另一个( page2,其中 url 像“mysite.com/lots/view/8188/”):
sendingRequest.CookieContainer = new CookieContainer();
sendingRequest.CookieContainer.Add(sendingRequest.RequestUri, new Cookie(ASPNETSessionIdCookieName, this.ASPNETSessionIdCookie));
sendingRequest.AllowAutoRedirect = true;
sendingRequest.MaximumAutomaticRedirections = 100;
HttpWebResponse response = (HttpWebResponse)sendingRequest.GetResponse();
好的,page1 向我返回预期的 HTTP 302 页面,预期的 url 为 page2,然后将发送请求转到 page2,但它不向 page2 发送 ASPNETSessionIdCookieName cookie,服务器返回不正确的响应。 如何使用“ASPNETSessionIdCookieName”进行重定向请求?
【问题讨论】:
标签: c# httpwebrequest