HtmlAttributeEncode Method
Collapse the table of content
Expand the table of content

HttpEncoder::HtmlAttributeEncode Method (String^, TextWriter^)

.NET Framework (current version)
 

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.

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

public protected:
virtual void HtmlAttributeEncode(
	String^ value,
	TextWriter^ output
)

Parameters

value
Type: System::String^

The string to encode.

output
Type: System.IO::TextWriter^

The text writer to write the encoded value to.

Exception Condition
ArgumentNullException

output is null.

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.

.NET Framework
Available since 4.0
Return to top
Show:
© 2016 Microsoft