[英]Weird Content Type Redirect HttpWebRequest C#
Code: 码:
webRequest = WebRequest.Create("https://---.com/bbb.aspx") as HttpWebRequest;
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.CookieContainer = cookies;
webRequest.KeepAlive = true;
webRequest.Proxy = new WebProxy("127.0.0.1:8888");
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36";
webRequest.Referer = "https://---.com/bbb.aspx";
webRequest.MaximumAutomaticRedirections = 1;
webRequest.AllowAutoRedirect = true;
webRequest.ServicePoint.SetTcpKeepAlive(true, 15, 200);
webRequest.ServicePoint.UseNagleAlgorithm = false;
webRequest.ServicePoint.Expect100Continue = false;
its redirected to ccc.aspx..the http header (Fiddler) is 其重定向到ccc.aspx..http标头(Fiddler)是
POST https://---.com/bbb.aspx HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Referer: https://---.com/bbb.aspx
Host: ---.com
Cookie: ASP.NET_SessionId=************; skysales=**********
Content-Length: 1753
and it's successful direct to ccc.aspx, but why the content type header is application/x-www-form-urlencoded too, in fiddler, it's GET request, not POST 并且可以直接直接发送到ccc.aspx,但是为什么内容类型标头也是application / x-www-form-urlencoded ,在提琴手中,它是GET请求,而不是POST
GET https://---.com/ccc.aspx HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Host: ---.com
Cookie: ASP.NET_SessionId=*********; skysales=********
This is a bug in HttpWebRequest
, on this line of code . 在这行代码中 ,这是HttpWebRequest
的错误。
When handling redirect responses, they correctly reset the method, but do not remove related headers. 在处理重定向响应时,它们会正确重置方法,但不会删除相关的标头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.