日期:2014-05-18  浏览次数:20458 次

100分求教:url栏的查询字符串问题
写了一个商品搜索
localhost/myItem/s.aspx?wd=%e5%8d%97%e6%b9%96%20%e4%b8%9c

Request.QueryString[ "wd "]
得到为中文:南湖   东   //中间有个空隔

如果url是这样的
localhost/myItem/s.aspx?wd=南湖   东
则无法得到,求如何将这个字进行编码,

------解决方案--------------------
发送:
Response.Redirect( "localhost/myItem/s.aspx?wd= " + Server.UrlEncode( "南湖 东 "));

接受:
string str = Server.UrlDecode(Request.QueryString[ "wd "]);
------解决方案--------------------
wo

ding
------解决方案--------------------
amandag(高歌) 正解
------解决方案--------------------
javascript:
encodeURIComponent()
------解决方案--------------------
urlencode
------解决方案--------------------
学习
------解决方案--------------------
ding


------解决方案--------------------
lz用 URL编码 问题解决了吧,
jf
------解决方案--------------------
amandag(高歌) 正解

------解决方案--------------------
localhost/myItem/s.aspx?wd=%e5%8d%97%e6%b9%96%20%e4%b8%9c
不是自动编码
------解决方案--------------------
up
------解决方案--------------------
二楼正确