Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HtmlHelper.AttributeEncode Method (String)

.NET Framework 4

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

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

public string AttributeEncode(
	string value
)

Parameters

value
Type: System.String
The string to encode.

Return Value

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

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

The result should be used only for attributes that are in double quotation marks. Security issues might arise if you use the AntiForgeryToken method to encode attributes that are in single quotation marks.

Community Additions

ADD
Show:
© 2015 Microsoft