?
Solved

Converting Windows Form code to ASP.NET

Posted on 2006-04-25
2
Medium Priority
?
365 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:clintnash
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
junglerover77 earned 2000 total points
ID: 16540710
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
 
LVL 6

Expert Comment

by:junglerover77
ID: 16540821
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question