Hi,
I’m trying to get the Serial Number of the local client from an ASP.NET webpage. When I run the code below I get the following error: Any ideas? SNosko
______
ERROR:
Exception Details: System.Exception: Cannot create ActiveX component.
Source Error:
Line 94: Private Function SerialNum()
Line 95: Dim strComputer = Request.UserHostName
Line 96: Dim objWMIService = GetObject("winmgmts:" _
Line 97: & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Line 98: Dim colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Source File: \\bhcsql\ Line: 96
Stack Trace:
[Exception: Cannot create ActiveX component.]
Microsoft.VisualBasic.Interaction.GetObject(String PathName, String Class) +62
BHCWOSystem.WebForm1.SerialNum() in \\bhcsql\ BHCWOSystem.WebForm1.btnEnter_Click(Object sender, EventArgs e) in \\bhcsql\ System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
_________
CODE: (Not all of the code: Only the necessary code)
Imports System
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.management
Imports System.Web
Imports System.Net
Public ReadOnly Property UserHostAddress() As String
Get
Dim instance As HttpRequest
Dim IPAddr As String
IPAddr = instance.UserHostAddress
End Get
End Property
Private Function SerialNum()
Dim strComputer = Request.UserHostName
Dim objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Dim objBIOS
For Each objBIOS In colBIOS
varSerialNum = objBIOS.SerialNumber
Next
Return varSerialNum
End Function
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
SerialNum()
Me.txtSNum.Text = varSerialNum
End Sub
I’m trying to get the Serial Number of the local client from an ASP.NET webpage. When I run the code below I get the following error: Any ideas? SNosko
______
ERROR:
Exception Details: System.Exception: Cannot create ActiveX component.
Source Error:
Line 94: Private Function SerialNum()
Line 95: Dim strComputer = Request.UserHostName
Line 96: Dim objWMIService = GetObject("winmgmts:" _
Line 97: & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Line 98: Dim colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Source File: \\bhcsql\ Line: 96
Stack Trace:
[Exception: Cannot create ActiveX component.]
Microsoft.VisualBasic.Interaction.GetObject(String PathName, String Class) +62
BHCWOSystem.WebForm1.SerialNum() in \\bhcsql\ BHCWOSystem.WebForm1.btnEnter_Click(Object sender, EventArgs e) in \\bhcsql\ System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
_________
CODE: (Not all of the code: Only the necessary code)
Imports System
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.management
Imports System.Web
Imports System.Net
Public ReadOnly Property UserHostAddress() As String
Get
Dim instance As HttpRequest
Dim IPAddr As String
IPAddr = instance.UserHostAddress
End Get
End Property
Private Function SerialNum()
Dim strComputer = Request.UserHostName
Dim objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
Dim objBIOS
For Each objBIOS In colBIOS
varSerialNum = objBIOS.SerialNumber
Next
Return varSerialNum
End Function
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
SerialNum()
Me.txtSNum.Text = varSerialNum
End Sub