我已经启动并运行了以下代码。它捕获用于访问Intranet站点的用户名和浏览器。如何修改代码以便ELMAH将特定的StatusCode记录到SQLServer中的ELMAH_Error表?最终的目标是能够从日志中提取这些特定的日志条目,以确定哪些PC需要升级。
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started'
Dim ExceptionMessage As New StringBuilder
ExceptionMessage.Append(System.Security.Principal.WindowsIdentity.GetCurrent.Name + " accessed the site using " + Request.Browser.Browser + " " + Request.Browser.MajorVersion.toString + "." + Request.Browser.MinorVersion.tostring)
Dim NewException As New NotSupportedException(ExceptionMessage.ToString)
Elmah.ErrorSignal.FromCurrentContext().Raise(NewException)
End Sub