开发者

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&param2=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)
%>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜