HttpEncoder.HtmlAttributeEncode(String, TextWriter) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 <
and the \
(backslash) is encoded as \
.
It is safe to use HtmlAttributeEncode within single-quoted and double-quoted attributes. The values must be quoted.