开发者

changing value of QueryString

I got the error 开发者_如何学JAVAin Query String. My project was written by ms visual studio 2003. Please see my code below

<a target="_blank" href="./PageOne.aspx?Customer=NAME1 + NAME2 + NAME3 PARA TEST">NAME1 + NAME2 + NAME3 PARA TEST</a>

System tried to get the customer value at PageOne like below

Request.QueryString("Customer").ToString

The value is

NAME1   NAME2   NAME3 PARA TEST

The plus sign is replaced by space. Please share me how to fix this.


URL's are subject to URL encoding and decoding. And unfortunately for your URL, in this encoding scheme a + represents a literal space. You can fix this issue by encoding the URL yourself so that the browser knows that you have literal + signs in your parameter that should be preserved, like:

<a target="_blank" href="./PageOne.aspx?Customer=NAME1+%2b+NAME2+%2b+NAME3+PARA+TEST">


Try Url decoding in the URL - More info here - HttpServerUtility.UrlDecode Method (String)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜