AlexTekTip
Programmer
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.
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.