SPEncode.WriteHtmlEncode Method
Encodes the specified string so that characters in embedded HTML tags are displayed as text in the browser, and writes the string to the HTTP output content stream.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedExternalType)> _
Public Shared Sub WriteHtmlEncode ( _
response As HttpResponse, _
str As String _
)
'Usage
Dim response As HttpResponse
Dim str As StringSPEncode.WriteHtmlEncode(response, str)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedExternalType)]
public static void WriteHtmlEncode(
HttpResponse response,
string str
)
Parameters
response
Type: System.Web.HttpResponseThe System.HttpResponse object for the current HTTP request.
str
Type: System.StringThe string to encode.
Remarks
The WriteHtmlEncode method converts characters that could be confused with HTML tags to entities. For example, "<" is converted to "<".
This method replaces multiple spaces in the string with a single space.