是不是HttpWebRequest自己的问题
您好:
如下代码:
1.工程示例代码:
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri("http://localhost/test.asp?code=中国", true));
HttpWebResponse webRes = (HttpWebResponse)webReq.GetResponse();
StreamReader readStream = new StreamReader( webRes.GetResponseStream(), Encoding.GetEncoding("GB2312"));
string strHtml = readStream.ReadToEnd();
2.TEST.ASP代码:
<html>
<body>
<%
Response.Write Request.QueryString("code")
%>
</body>
</html>
我发现:
不论Uri的构造函数是否已转义定义为TRUE还是FALSE,返回的信息都不正确,但是在浏览器中却是正确的。
不知道什么原因,希望您能够给予指导,谢谢!!!