clintnash
asked on
Converting Windows Form code to ASP.NET
Hello,
I have a requirement to implement a USB security key into the security model of our software. I purchased an evaluation kit from a company who claims it has a number of clients who use the dongle in ASP.NET applications. The sample code is VB.NET, but its windows form. The steps I have taken so far don't produce an error, but it also doesn't work. The lines of code that I think are giving me the problem are the ones that refer to the DLL.
Declare Function KFUNC Lib "KL2DLL32.DLL" Alias "_KFUNC@16" (ByVal arg1 As Integer, ByVal arg2 As Integer, ByVal arg3 As Integer, ByVal arg4 As Integer) As Integer
Does anyone have experience in migrating from vb.net to asp.net or recognize how the statement above may be the problem OR have any ideas on how to move forward through this?
Thanks,
clint
I have a requirement to implement a USB security key into the security model of our software. I purchased an evaluation kit from a company who claims it has a number of clients who use the dongle in ASP.NET applications. The sample code is VB.NET, but its windows form. The steps I have taken so far don't produce an error, but it also doesn't work. The lines of code that I think are giving me the problem are the ones that refer to the DLL.
Declare Function KFUNC Lib "KL2DLL32.DLL" Alias "_KFUNC@16" (ByVal arg1 As Integer, ByVal arg2 As Integer, ByVal arg3 As Integer, ByVal arg4 As Integer) As Integer
Does anyone have experience in migrating from vb.net to asp.net or recognize how the statement above may be the problem OR have any ideas on how to move forward through this?
Thanks,
clint
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function GetWinPath()
Dim strFolder As String
Dim lngResult As Long
strFolder = New String(Chr(0), 255)
lngResult = GetWindowsDirectory(strFol
If lngResult <> 0 Then
GetWinPath = Left(strFolder, InStr(strFolder, Chr(0)) - 1)
Else
GetWinPath = ""
End If
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack() Then
Label1.Text = GetWinPath()
End If
End Sub
I think there shouldn't be any difference between windows forms and asp.net pages when calling an API. But the reason of your error might be: Your IIS allows Anonymous Access, but the anonymous user doesn't have the permission to Execute an API.