C# UrlEncode()

UrlEncode - encodes a string and returns the encoded string.

Function

public string UrlEncode( string s )

Parameters

s - The text to URL - encode.

Return value

Type: System.String - The encoded text.

Example

String UrlString = "url encoder";
String EncodedString = Server.UrlEncode( UrlString );
Response.Write( "http://example.com/?param=" + EncodedString );

Output

http://example.com/?param=url+encoder

Github

See also: