HtmlHelper.AttributeEncode Method (String)

Returns an HTML-encoded string that represents the specified string by using a minimal encoding that is suitable only for HTML attributes that are enclosed in quotation marks.

Namespace:  System.Web.WebPages.Html
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)


Public Function AttributeEncode ( _
    value As String _
) As String
Dim instance As HtmlHelper 
Dim value As String 
Dim returnValue As String 

returnValue = instance.AttributeEncode(value)
public string AttributeEncode(
    string value
String^ AttributeEncode(
    String^ value
member AttributeEncode : 
        value:string -> string
public function AttributeEncode(
    value : String
) : String


Return Value

Type: System.String
An HTML-encoded string that represents the original string.


Minimal HTML-encoding converts only double-quotation ("), ampersand (&), and less than (<) characters to their corresponding HTML escape sequences. This is faster than full HTML encoding, but is suitable only for encoding HTML attributes that are in double quotation marks.

See Also


HtmlHelper Class

AttributeEncode Overload

System.Web.WebPages.Html Namespace