gpt4 book ai didi

c# - 您必须使用支持并启用JavaScript的浏览器-C#

转载 作者:太空宇宙 更新时间:2023-11-03 17:36:58 25 4
gpt4 key购买 nike

我正在尝试使用HTTPWebrequest进行发布,这是我不断得到的回复:

您必须使用支持并启用JavaScript的浏览器

这是我的邮政编码:

HttpWebRequest myRequest = null;
myRequest = (HttpWebRequest)HttpWebRequest.Create(submitURL);
myRequest.Headers.Add("Accept-Language", "en-US");
myRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
myRequest.Method = WebRequestMethods.Http.Post;
myRequest.Headers.Add("Accept-Language", "en-US");
myRequest.Accept = "*/*, text/xml";
myRequest.ContentType = "application/x-www-form-urlencoded" + "\n" + "\r";
myRequest.CookieContainer = cookieContainer;
myRequest.Headers.Add("UA-CPU", "x86");
myRequest.Headers.Add("Accept-Encoding", "gzip, deflate");

//cPostData section removed as submitting to SO

myRequest.ContentLength = cPostData.Length;

myRequest.ServicePoint.Expect100Continue = false;

StreamWriter streamWriter = new System.IO.StreamWriter(myRequest.GetRequestStream());
streamWriter.Write(cPostData);
streamWriter.Close();


HttpWebResponse httpWebResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader streamReader = new System.IO.StreamReader(httpWebResponse.GetResponseStream());
string stringResult = streamReader.ReadToEnd();
streamReader.Close();


我如何避免出现此错误?

最佳答案

很难说出确切的问题是什么,因为接收您请求的服务器认为它无效。

也许第一件事就是将UserAgent上的HttpWebRequest属性设置为某个有效浏览器的用户代理字符串,因为服务器可能正在使用该值来确定是否为该页面提供服务。

关于c# - 您必须使用支持并启用JavaScript的浏览器-C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1357608/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com