Aracılığıyla paylaş


WebApplicationInformation.FormatToString(WebEventFormatter) Yöntem

Tanım

Uygulama 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)
{
    base.FormatCustomEventDetails(formatter);

    // Add custom data.
    formatter.AppendLine("");
    formatter.AppendLine(
    "Custom Application Information:");
    formatter.IndentationLevel += 1;

    // Display the application information.
    formatter.AppendLine(GetApplicationDomain());
    formatter.AppendLine(GetApplicationPath());
    formatter.AppendLine(GetApplicationVirtualPath());
    formatter.AppendLine(GetApplicationMachineName());
    formatter.AppendLine(GetApplicationTrustLevel());
    formatter.IndentationLevel -= 1;
    formatter.AppendLine(eventInfo.ToString());
}
    'Formats Web request event information.
    Public Overrides Sub FormatCustomEventDetails( _
 _
     ByVal formatter As WebEventFormatter)
        MyBase.FormatCustomEventDetails(formatter)

        ' Add custom data.
        formatter.AppendLine( _
        "Custom Application Information:")
        formatter.IndentationLevel += 1

        ' Display the application information.
        formatter.AppendLine(GetApplicationDomain())
        formatter.AppendLine(GetApplicationPath())
        formatter.AppendLine(GetApplicationVirtualPath())
        formatter.AppendLine(GetApplicationMachineName())
        formatter.AppendLine(GetApplicationTrustLevel())
        formatter.IndentationLevel -= 1
        formatter.AppendLine(eventInfo.ToString())
    End Sub
End Class

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.

Not

Görüntü için özel olay bilgilerinizi biçimlendirirken, yöntemi yerine ToString yöntemini geçersiz kılınFormatToString. Bu, hassas sistem bilgilerinin üzerine yazılmasını veya kurcalanmasını önler.

Şunlara uygulanır