繁体   English   中英

奇怪的内容类型重定向HttpWebRequest C#

[英]Weird Content Type Redirect HttpWebRequest C#

码:

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;

其重定向到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

并且可以直接直接发送到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=********

这行代码中 ,这是HttpWebRequest的错误。

在处理重定向响应时,它们会正确重置方法,但不会删除相关的标头。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM