本文整理汇总了VB.NET中System.Web.Management.WebApplicationInformation类的典型用法代码示例。如果您正苦于以下问题:VB.NET WebApplicationInformation类的具体用法?VB.NET WebApplicationInformation怎么用?VB.NET WebApplicationInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebApplicationInformation类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: SampleWebApplicationInformation
' 导入命名空间
Imports System.Text
Imports System.Web
Imports System.Web.Management
'Implements a custom WebBaseEvent that uses
' WebApplicationInformation.
Public Class SampleWebApplicationInformation
Inherits WebBaseEvent
Private eventInfo As StringBuilder
' Instantiate SampleWebGet
Public Sub New(ByVal msg As String, _
ByVal eventSource As Object, _
ByVal eventCode As Integer)
MyBase.New(msg, eventSource, eventCode)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: {0}", EventTime.ToString()))
End Sub
' Raises the event.
Public Overrides Sub Raise()
' Perform custom processing.
eventInfo.Append(String.Format( _
"Event raised at: {0}", EventTime.ToString()))
' Raise the event.
MyBase.Raise()
End Sub
Public Function GetApplicationDomain() As String
' Get the name of the application domain.
Return String.Format( _
"Application domain: {0}", _
ApplicationInformation.ApplicationDomain)
End Function 'GetApplicationDomain
Public Function GetApplicationPath() As String
' Get the name of the application path.
Return String.Format( _
"Application path: {0}", _
ApplicationInformation.ApplicationPath())
End Function 'GetApplicationPath
Public Function GetApplicationVirtualPath() As String
' Get the name of the application virtual path.
Return String.Format( _
"Application virtual path: {0}", _
ApplicationInformation.ApplicationVirtualPath())
End Function 'GetApplicationVirtualPath
Public Function GetApplicationMachineName() As String
' Get the name of the application machine name.
Return String.Format( _
"Application machine name: {0}", _
ApplicationInformation.MachineName())
End Function 'GetApplicationMachineName
Public Function GetApplicationTrustLevel() As String
' Get the name of the application trust level.
Return String.Format( _
"Application trust level: {0}", _
ApplicationInformation.TrustLevel())
End Function 'GetApplicationTrustLevel
'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