本文整理汇总了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