Aracılığıyla paylaş


WebRequestInformation.FormatToString(WebEventFormatter) Yöntem

Tanım

Web isteği bilgilerini biçimlendirin.

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)

Parametreler

formatter
WebEventFormatter

WebEventFormatter Web sistem durumu olay bilgilerini biçimlendirmek için kullanılan sekme ve girinti ayarlarını içeren.

Örnekler

Aşağıdaki kod örneğinde özel bilgilerin nasıl biçimlendirilir gösterilmektedir.


// 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

Açıklamalar

yöntemi, FormatToString olay bilgileri için tekdüzen bir biçim sağlar. Bu biçim, olay verilerinin günlüğe kaydedilmesi ve daha sonra kullanıcıya sunulması gerekiyorsa yararlıdır. Sağlayıcı yöntemlerden birini ToString çağırdığında dahili olarak çağrılır.

Şunlara uygulanır