HttpEncoder.JavaScriptStringEncode Method (String)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Encodes a string.

Namespace:   System.Web.Util
Assembly:  System.Web (in System.Web.dll)

abstract JavaScriptStringEncode : 
        value:string -> string
override JavaScriptStringEncode : 
        value:string -> string


Type: System.String

The string to encode.

Return Value

Type: System.String

An encoded string.

URL encoding makes sure that all browsers correctly transmit text in URL strings. Characters such as a question mark (?), ampersand (&), slash (/), and spaces might be truncated or corrupted by some browsers. Therefore, these characters must be encoded.

.NET Framework
Available since 4.5
Return to top