Muokkaa

Jaa


HttpEncoder.HtmlAttributeEncode(String, TextWriter) Method

Definition

Encodes an incoming value into a string that can be inserted into an HTML attribute that is delimited by using single or double quotation marks.

protected public:
 virtual void HtmlAttributeEncode(System::String ^ value, System::IO::TextWriter ^ output);
protected internal virtual void HtmlAttributeEncode (string value, System.IO.TextWriter output);
abstract member HtmlAttributeEncode : string * System.IO.TextWriter -> unit
override this.HtmlAttributeEncode : string * System.IO.TextWriter -> unit
Protected Friend Overridable Sub HtmlAttributeEncode (value As String, output As TextWriter)

Parameters

value
String

The string to encode.

output
TextWriter

The text writer to write the encoded value to.

Exceptions

output is null.

Remarks

The HtmlAttributeEncode method encodes characters by using the standard HTML entities. For example, the < (left angle bracket) is encoded as &lt; and the \ (backslash) is encoded as &#92;.

It is safe to use HtmlAttributeEncode within single-quoted and double-quoted attributes. The values must be quoted.

Applies to