且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查询字符串中不显示特殊字符

更新时间:2022-05-30 07:42:25

使用URL编码和解码

在c#中使用如下:

string url = HttpUtility.UrlEncode( http://www.abc.com/a?q=b);
use URL Encoding and decoding
In c# use as follow:
string url = HttpUtility.UrlEncode("http://www.abc.com/a?q=b");


使用 Server.UrlEncode


use Server.UrlEncode,

here it is an example...
Dim MyURL As String
MyURL = "http://www.contoso.com/articles.aspx?title=" & Server.UrlEncode("ASP.NET Examples")

Response.Write( "<a href=" & MyURL & "> ASP.NET Examples </a>")



快乐编码!

:)


Happy Coding!
:)