如何传递带有特殊字符的查询字符串?
例如,我需要在我的查询字符串中传递“&”,如下所示:
../solrresults.asp?mode=search&data=M & S
最佳答案
使用 Server.UrlEncode
:
URLEncode converts characters as follows: Spaces ( ) are converted to plus signs (+). Non-alphanumeric characters are escaped to their hexadecimal representation.
以这种方式使用它;
<a href="page2.asp?name=<%= Server.URLEncode(sName) %>">here</a>
关于url - 查询带有特殊字符的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9579151/