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.
Assembly: System.Web (in System.Web.dll)
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 < and the \ (backslash) is encoded as \.
It is safe to use HtmlAttributeEncode within single-quoted and double-quoted attributes. The values must be quoted.
.NET Framework
Available since 4.0
Available since 4.0
Show: