Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Trying to use Lin ADVAPI32.DLL in ASP.

Reply
Thread Tools

Trying to use Lin ADVAPI32.DLL in ASP.

 
 
Alex Wolff
Guest
Posts: n/a
 
      09-21-2004
Hello,

I have the following snippet of code, which in VB gives me the current
network login. I am trying to migrate the code to asp so I can use it from a
web page. When I call my asp page the web server returns an error:
Technical Information (for support personnel)

Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/SLApprover/MyVersion.asp, line 3, column 8


***Code Snippet Begins Here****
<%@ Language=VBScript %>
<%
Declare function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal
lpBuffer As String, nSize As Long) As Long

Dim NTUserName

function OSUserName()
Dim cn as String
Dim ls as Long
Dim res as Long
cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)
If res <> 0 Then
OSusername = mid(cn, 1, InStr(cn, Chr(0)) - 1)
Else
OSusername = ""
End if
end function

NTUserName = OSUserName()
Response.Write("The NT User Name is: " & NTUserName)

%>
***Code Snippet End Here****



Any obvious problems? Can I not call the windows API libraries from ASP?

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
table (ascii text) lin ayout recognition vbfoobar@gmail.com Python 6 09-14-2006 12:13 AM
win-lin Michael Sgier C++ 11 10-23-2005 03:46 AM
porting win to lin by newbie Michael Sgier C++ 1 07-21-2005 08:59 AM
1. Porting win to lin Michael Sgier C++ 2 07-10-2005 11:57 AM
Portable libraries for Mac/Win/Lin? Christian Decker C++ 3 10-19-2004 07:13 PM



Advertisments