HttpUtility.HtmlEncode Method (Object)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Converts an object's string representation into an HTML-encoded string, and returns the encoded string.

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

public static string HtmlEncode(
	object value


Type: System.Object

An object.

Return Value

Type: System.String

An encoded string.

To encode or decode values outside of a web application, use the WebUtility class.

.NET Framework
Available since 4.0
Return to top