[英]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.