Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HtmlHelper.AttributeEncode Method

.NET Framework 4

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

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method AttributeEncode(Object) Converts the specified attribute object to an HTML-encoded string.
Public method AttributeEncode(String) Converts the specified attribute string to an HTML-encoded string.
Top

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.