本文整理匯總了VB.NET中System.Web.Management.WebProcessInformation類的典型用法代碼示例。如果您正苦於以下問題:VB.NET WebProcessInformation類的具體用法?VB.NET WebProcessInformation怎麽用?VB.NET WebProcessInformation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了WebProcessInformation類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: SampleWebProcessInformation
' 導入命名空間
Imports System.Text
Imports System.Web
Imports System.Web.Management
' Implements a custom WebBaseEvent type that
' uses WebProcessInformation.
Public Class SampleWebProcessInformation
Inherits WebBaseEvent
Private eventInfo As StringBuilder
Private Shared processInformation _
As WebProcessInformation
' Instantiate SampleWebProcessInformation.
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 GetAccountName() As String
' Get the name of the account.
Return String.Format("Account name: {0}", _
processInformation.AccountName)
End Function 'GetAccountName
Public Function GetProcessId() As String
' Get the process identifier.
Return String.Format("Process Id: {0}", _
processInformation.ProcessID.ToString())
End Function 'GetProcessId
Public Function GetProcessName() As String
' Get the requests in execution.
Return String.Format("Process name: {0}", _
ProcessInformation.ProcessName)
End Function 'GetProcessName
'Formats Web request event information.
Public Overrides Sub FormatCustomEventDetails( _
ByVal formatter _
As System.Web.Management.WebEventFormatter)
MyBase.FormatCustomEventDetails(formatter)
' Add custom data.
formatter.AppendLine("")
formatter.AppendLine( _
"Custom Process Information:")
formatter.IndentationLevel += 1
' Display the process information.
formatter.AppendLine(GetAccountName())
formatter.AppendLine(GetProcessId())
formatter.AppendLine(GetProcessName())
formatter.IndentationLevel -= 1
formatter.AppendLine(eventInfo.ToString())
End Sub
End Class