XmlHttpRequest with asp.net

XmlHttpRequest with asp.net

本文关键字:net asp with XmlHttpRequest      更新时间:2023-09-26

我尝试发送一个get请求到我的ashx文件。但是我的性格有问题。
问题是当我通过firefox或chrome发送请求时没有问题,但当尝试用IE发送时,我无法
得到我发送的内容。我发送"Ç"字符,但在服务器端我不能得到它。

myRequest.open("GET", "/Search.ashx?SearchText=" + search + "", true);
myRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
myRequest.send(null);

似乎你还没有编码'搜索'字符串与encodeURIComponent函数使用javascript。在ashx端,您可以使用httutility。

encodeuriccomponent (search) is answer