Hey Guys,
I'm trying to use a registered COM component in my ASP.Net web application. The application is written in VB.Net.
I've added a reference to the Com component using the IDE.
Here's the code:
Try
Dim physicalToken As New PhysicalDevices2.PhysicalToken
Dim physicalTokens As New PhysicalDevices2.PhysicalTokens
Dim roCollection As PhysicalDevices2.ROCollection
If Not IsDBNull(physicalTokens) Then
Response.Write("physicalTokens not Null<br>")
roCollection = physicalTokens.Enumerate()
Dim count As Integer = roCollection.Count
Response.Write(count.ToString + "<br>")
physicalToken = physicalTokens.GetFirstToken()
If Not IsDBNull(physicalToken) Then
Response.Write("physicalToken not Null<br>")
Response.Write(physicalToken.SerialString + "<br>")
Else
Response.Write("physicalToken Null<br>")
End If
Else
Response.Write("physicalTokens Null<br>")
End If
Catch excp As Exception
Response.Write(excp.Message + "<br>")
End Try
And the output:
physicalTokens not Null
0
physicalToken not Null
Object reference not set to an instance of an object.
The last line of the output is referring to physicalToken.SerialString
When I try the same thing in a standard vbs script:
dim physicalToken
dim roCollection
Set physicalTokens = WScript.CreateObject ("PhysicalDevices2.PhysicalTokens" )
If not IsNull(physicalToken ) Then
wscript.echo "physicalTokens not Null"
set roCollection = physicalTokens.Enumerate()
wscript.echo roCollection.Count
set physicalToken = physicalTokens.GetFirstToken()
If Not IsNull(physicalToken) Then
wscript.echo "physicalToken not Null"
wscript.echo physicalToken.SerialString
Else
wscript.echo "physicalToken Null"
End If
Else
wscript.echo "physicalTokens Null"
End If
I get the correct expected output:
physicalTokens not Null
1
physicalToken not Null
05937386d9f031df
Being that I'm not proficient in VB.Net, I'm thinking that it's probably a syntax problem of some sort.
Your help is most appreciated,
Aron-Zvi
I'm trying to use a registered COM component in my ASP.Net web application. The application is written in VB.Net.
I've added a reference to the Com component using the IDE.
Here's the code:
Try
Dim physicalToken As New PhysicalDevices2.PhysicalToken
Dim physicalTokens As New PhysicalDevices2.PhysicalTokens
Dim roCollection As PhysicalDevices2.ROCollection
If Not IsDBNull(physicalTokens) Then
Response.Write("physicalTokens not Null<br>")
roCollection = physicalTokens.Enumerate()
Dim count As Integer = roCollection.Count
Response.Write(count.ToString + "<br>")
physicalToken = physicalTokens.GetFirstToken()
If Not IsDBNull(physicalToken) Then
Response.Write("physicalToken not Null<br>")
Response.Write(physicalToken.SerialString + "<br>")
Else
Response.Write("physicalToken Null<br>")
End If
Else
Response.Write("physicalTokens Null<br>")
End If
Catch excp As Exception
Response.Write(excp.Message + "<br>")
End Try
And the output:
physicalTokens not Null
0
physicalToken not Null
Object reference not set to an instance of an object.
The last line of the output is referring to physicalToken.SerialString
When I try the same thing in a standard vbs script:
dim physicalToken
dim roCollection
Set physicalTokens = WScript.CreateObject ("PhysicalDevices2.PhysicalTokens" )
If not IsNull(physicalToken ) Then
wscript.echo "physicalTokens not Null"
set roCollection = physicalTokens.Enumerate()
wscript.echo roCollection.Count
set physicalToken = physicalTokens.GetFirstToken()
If Not IsNull(physicalToken) Then
wscript.echo "physicalToken not Null"
wscript.echo physicalToken.SerialString
Else
wscript.echo "physicalToken Null"
End If
Else
wscript.echo "physicalTokens Null"
End If
I get the correct expected output:
physicalTokens not Null
1
physicalToken not Null
05937386d9f031df
Being that I'm not proficient in VB.Net, I'm thinking that it's probably a syntax problem of some sort.
Your help is most appreciated,
Aron-Zvi