开发者

Server.UrlEncode is not working for " * " ASP.net 3.5

开发者 https://www.devze.com 2023-01-11 15:19 出处:网络
Why? 开发者_如何转开发 Server.UrlEncode(\"2*\") return 2* while it should return 2%2A as tested on this demo siteRFC 1738 specifically allows * in the URL:

Why?

开发者_如何转开发
Server.UrlEncode("2*")

return 2*

while it should return 2%2A

as tested on this demo site


RFC 1738 specifically allows * in the URL:

Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

So, there is no need to encode it.

The page you link to is a classic asp page so uses UrlEncode, so quite an old implementation and not the .NET one.


According to .NET, * is a 'safe' character and needs not to be encoded.

Whether this is actually correct or not, I do not know.

0

精彩评论

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