HttpUtility.JavaScriptStringEncode Method

.NET Framework (current version)
 
System_CAPS_noteNote

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

Encodes a string.

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

This method encodes strings. For instance, single quotation marks and double quotation marks are included as \' and \" in the 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 in a elements or in query strings where the strings can be re-sent by a browser in a request string.

Return to top
Show: