WebRequestInformation.FormatToString(WebEventFormatter) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Formata a informação do pedido na Web.
public:
void FormatToString(System::Web::Management::WebEventFormatter ^ formatter);
public void FormatToString(System.Web.Management.WebEventFormatter formatter);
member this.FormatToString : System.Web.Management.WebEventFormatter -> unit
Public Sub FormatToString (formatter As WebEventFormatter)
Parâmetros
- formatter
- WebEventFormatter
O WebEventFormatter que contém o separador e as definições de indentação usadas para formatar a informação do evento de saúde na Web.
Exemplos
O seguinte exemplo de código mostra como formatar informação personalizada.
// Formats Web request event information.
public override void FormatCustomEventDetails(
WebEventFormatter formatter)
{
// Add custom data.
formatter.AppendLine("");
formatter.AppendLine(
"Custom Request Information:");
formatter.IndentationLevel += 1;
// Display the request information obtained
// using the WebRequestInformation object.
formatter.AppendLine(GetRequestPath());
formatter.AppendLine(GetRequestUrl());
formatter.AppendLine(GetRequestUserHostAdddress());
formatter.AppendLine(GetRequestPrincipal());
formatter.IndentationLevel -= 1;
formatter.AppendLine(eventInfo.ToString());
}
' Formats Web request event information.
Public Overrides Sub FormatCustomEventDetails( _
ByVal formatter As WebEventFormatter)
' Add custom data.
formatter.AppendLine("")
formatter.AppendLine("Custom Request Information:")
formatter.IndentationLevel += 1
' Display the request information obtained
' using the WebRequestInformation object.
formatter.AppendLine(GetRequestPath())
formatter.AppendLine(GetRequestUrl())
formatter.AppendLine(GetRequestUserHostAdddress())
formatter.AppendLine(GetRequestPrincipal())
formatter.IndentationLevel -= 1
formatter.AppendLine(eventInfo.ToString())
End Sub
Observações
O FormatToString método fornece um formato uniforme para a informação do evento, o que é útil se os dados do evento tiverem de ser registados e posteriormente apresentados ao utilizador. É chamado internamente quando o prestador invoca um dos ToString métodos.