HtmlHelper.AttributeEncode Method (Object)

Converts the specified attribute object to an HTML-encoded string.

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

public string AttributeEncode(
	Object value
)

Parameters

value
Type: System.Object
The object to be encoded

Return Value

Type: System.String
The HTML-encoded string. If the value parameter is null or empty, this method will return an empty string.

The AntiForgeryToken method converts only quotation marks ("), ampersands (&), and left angle brackets (<) to equivalent character entities.

The string result should be used only for double-quoted attributes. Security issues might arise when using the AntiForgeryToken method with single-quoted attributes.

Show: