共用方式為


WriteHtmlEncode Method

The WriteHtmlEncode method of the SPEncode class 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.

Parameters

response   The System.HttpResponse object for the current HTTP request.

str   The string to encode.

Remarks

The WriteHtmlEncode method converts characters that could be confused with HTML tags to entities. For example, "<" is converted to "&lt;".

This method replaces multiple spaces in the string with a single space.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security