簡體   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