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
LVL 1
clintnashAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

junglerover77Commented:
Change it to:

Private Declare Auto 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

Then it should be all right.

Jungle
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
junglerover77Commented:
Please test the following code with an asp.net web page, it runs well on my computer.

    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(strFolder, 255)
        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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.