Freigeben über


Server.URLEncode Method

The URLEncode method applies URL encoding rules, including escape characters, to a specified string.

URLEncode converts characters as follows:

  • Spaces ( ) are converted to plus signs (+).

  • Non-alphanumeric characters are escaped to their hexadecimal representation.

URLEncode(
      string
)

Parameters

  • string
    Specifies the string to encode.

Return Values

This method has no return values.

Example Code

The following script:

<%Response.Write(Server.URLEncode("https://www.microsoft.com")) %> 

produces the following output:

http%3A%2F%2Fwww%2Emicrosoft%2Ecom  

Applies To

Server Object

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also