本文整理匯總了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