我创建了一个程序,试图在网站上发布一个字符串,我收到此错误:
"服务器提交了协议违规.Section = ResponseStatusLine"
在这行代码之后:
gResponse = (HttpWebResponse)gRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个异常?
我正在制作一个网站,我希望它在正式发布时与即将推出的Microsoft Edge兼容.更具体地说,它的移动版本.有谁知道什么字符串将识别边缘移动浏览器(例如,"IE Mobile"标识Internet Explorer的移动版本).
我正在尝试从 https 网站下载 pdf 文件,但它不起作用。我是 C# 新手,所以做了一些研究并找到了一个简单的代码。更糟糕的是,我得到的异常非常普遍。请帮助。
static void Main(string[] args)
{
string file_ = "https://www.nseindia.com/content/circulars/CMPT34469.pdf";
string path_ = @"E:\RSR\Office\EEP\FileDownloader\output\Hello_World.pdf";
WebClient wc_ = new WebClient();
wc_.DownloadFile(file_, path_);
}
Run Code Online (Sandbox Code Playgroud)
异常:System.dll 中发生类型为“System.Net.WebException”的未处理异常附加信息:远程服务器返回错误:(403) 禁止。