url encode in asp3
how can I set the url e开发者_JS百科ncode in asp3 similar to the asp.net code
Public Shared Function UrlEncode ( _
str As String, _
e As Encoding _
) As String
how can I pass the encoding type?
Simply call UrlEncode and as the second parameter specify the encoding
http://msdn.microsoft.com/en-us/library/h10z5byc.aspx
This same overload is supported in .net 3 so you should be good.
Use Server.URLEncode(string) for classic asp.
<% response.write(Server.URLEncode("http://www.myurl.com?param1=value1¶m2=value2")) %>
You could also UriEncode but this function is only pressent in javascript but you can switch language in asp-classic
<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
function fnencodeURIComponent(n)
{
return encodeURIComponent(n)
}
function fndecodeURIComponent(n)
{
return decodeURIComponent(n)
}
</SCRIPT>
<% 'normal asp
url = fnencodeURIComponent(myString)
%>
精彩评论