System.Web.HttpUtility.HtmlAttributeEncode Method

Minimally converts a string to an HTML-encoded string.

Syntax

public static string HtmlAttributeEncode (string s)

Parameters

s
The string to encode.

Returns

An encoded string.

Remarks

The HttpUtility.HtmlAttributeEncode(string) method converts only quotation marks ("), ampersands (&), and left angle brackets (<) to equivalent character entities. It is considerably faster than the HttpUtility.HtmlEncode(string) method.

The string result from the HttpUtility.HtmlAttributeEncode(string) method should be used only for double-quoted attributes. Security issues might arise when using the HttpUtility.HtmlAttributeEncode(string) method with single-quoted attributes.

Requirements

Namespace: System.Web
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0