HtmlHelper::AttributeEncode Method

 

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

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

NameDescription
System_CAPS_pubmethodAttributeEncode(Object^)

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

System_CAPS_pubmethodAttributeEncode(String^)

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

Return to top

HtmlHelper::AttributeEncode Method (Object^)

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

public:
String^ AttributeEncode(
	Object^ value
)

Parameters

value
Type: System::Object^

The object 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.

Return to top

HtmlHelper::AttributeEncode Method (String^)

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

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.

Return to top
Show: