AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

StringExtensions..::..HTMLEncode Method

HTML-encodes the string, converting special characters to their HTML entity equivalents.

Namespace:  AdvantageCMS.Core.Common
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static string HTMLEncode(
	this string s
)

Parameters

s
Type: String
The string to encode.

Return Value

The HTML-encoded string.

Examples


C#
string encoded = "<script>alert('xss')</script>".HTMLEncode();
// returns "&lt;script&gt;alert('xss')&lt;/script&gt;"