Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WebClient,查询字符串中的重音字符_C#_Webclient_Non Ascii Characters - Fatal编程技术网

C# WebClient,查询字符串中的重音字符

C# WebClient,查询字符串中的重音字符,c#,webclient,non-ascii-characters,C#,Webclient,Non Ascii Characters,我使用WebClient类从ASP.NET应用程序在服务器(Oracle Reports)上运行查询。我没有服务器,我只能访问一些日志 在一种情况下,发送到服务器的查询字符串包含重音字符(é)。WebClient类在发送请求之前对查询字符串进行编码(UrlEncode)(变成%C3%A9)。但是我的服务器不懂这种编码 在对已知客户机(IE 11和Chrome 32)进行了一些测试之后,我发现IE 11没有对查询字符串进行编码,而Chrome是 在服务器上,我有http://myserver/re

我使用WebClient类从ASP.NET应用程序在服务器(Oracle Reports)上运行查询。我没有服务器,我只能访问一些日志

在一种情况下,发送到服务器的查询字符串包含重音字符(é)。WebClient类在发送请求之前对查询字符串进行编码(UrlEncode)(变成%C3%A9)。但是我的服务器不懂这种编码

在对已知客户机(IE 11和Chrome 32)进行了一些测试之后,我发现IE 11没有对查询字符串进行编码,而Chrome是

在服务器上,我有
http://myserver/reports/rwservlet?test=é
url:

IE : "GET / reports/rwservlet test=\XE9 HTTP/1.1 ?"

Chrome : "GET /reports/rwservlet test=%C3%A9 HTTP/1.1 ?"
对于WebClient类,我得到了与whith Chrome相同的结果

当我从WebClient类使用IE时,如何使我的服务器接收到与IE相同的URL

我能告诉WebClient类不要对我的参数值进行URL编码吗?或者我可以使用WebClient以外的类吗

谢谢大家!


换句话说,我必须从ASP.NET应用程序发送一个HTTP请求,其中包含一个查询字符串未编码!我尝试使用WebClient和WebRequest,但URL始终是编码的…

我无法使用POST方法:

string url = "http://myUrl.com/page";
string parameters = "param1=un&param2=ooohyé"
byte[] bytes = Encoding.GetEncoding("ISO-8859-1").GetBytes(parameters);
WebRequest webRequest = WebRequest.Create(url);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = bytes.Length;

Stream paramStream = webRequest.GetRequestStream();
paramStream.Write(bytes, 0, bytes.Length);
paramStream.Close();

WebResponse response = webRequest.GetResponse();