System.Web.HttpUtility.HtmlAttributeEncode Method

Minimally converts a string into an HTML-encoded string and sends the encoded string to a System.IO.TextWriter output stream.

Syntax

public static void HtmlAttributeEncode (string s, System.IO.TextWriter output)

Parameters

s
The string to encode
output
A System.IO.TextWriter output stream.

Remarks

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

The string result from the HttpUtility.HtmlAttributeEncode(string, System.IO.TextWriter) method should be used only for double-quoted attributes. Security issues might arise when using the HttpUtility.HtmlAttributeEncode(string, System.IO.TextWriter) 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