ASP: Get user login ID
From: Dale Fye (saic.com@dale.fye)
Date: 03/05/03
- Next message: scott: "Re: FTP Site Access - over the internet"
- Previous message: BB: "Re: Cannot login to a secured web site"
- Next in thread: Jeff Cochran: "Re: ASP: Get user login ID"
- Reply: Jeff Cochran: "Re: ASP: Get user login ID"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Dale Fye" <saic.com@dale.fye> Date: Wed, 5 Mar 2003 08:18:05 -0500
The team I am working on (most of us are new to web development) is
having a problem with what we thought would be a relatively simple
task.
We are developing a web application that will be running on our
company's intranet, and we want to capture who is using the
application, without writing any cookies to their system. We've
gotten some guidance regarding writing a .dll which we can register on
our web server and call from within our ASP code, but cannot get it to
work. When we write a VB app, that calls the dll (registered on our
local machine), it works fine. But when we register the dll on our web
server (IIS5), and call it from our ASP code, it generates an error.
I've included the code for the activex dll, the asp code, and the
error message we are getting. It seems to bomb out in the line where
we declare the GetUserName Lib (marked with the asterisks). We
thought the problem might be that the advapi32.dll was not registered
on the server, but our sysad indicated that it is part of the Windows
OS, and could not be registered or replaced on the server.
I'm now wondering whether there might be an IIS security setting that
is preventing this from working properly.
Any help would be greatly appreciated.
----------------------------------------
'activex dll
Option Explicit
**Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private mvarLoginName As PassLoginName
Public Function PassLoginName()
Const clngBuffSize As Long = 255
Dim lngCharsReturned As Long
Dim LoginName As String
Dim lngAPI As Variant
LoginName = String$(clngBuffSize + 1, 0)
lngCharsReturned = clngBuffSize
lngAPI = GetUserName(LoginName, lngCharsReturned)
If lngAPI = 0 Then
mvarLoginName = "Not known"
Else
mvarLoginName = Left(LoginName, lngCharsReturned - 1)
End If
End Function
----------------------------------------------------------------------
-------
'asp code
Dim ComObject
Dim LoggedInAs
Set ComObject = Server.CreateObject("GetLoginName.PassLoginName")
LoggedInAs = ComObject.LoginName
Response.Write "Logged in with the username of " & LoggedInAs
----------------------------------------------------------------------
-------
Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. --
-- HTH Dale Fye ****** Avoid Spam ************** To reply directly, modify my email address by swapping the text on either side of the @. ************************************
- Next message: scott: "Re: FTP Site Access - over the internet"
- Previous message: BB: "Re: Cannot login to a secured web site"
- Next in thread: Jeff Cochran: "Re: ASP: Get user login ID"
- Reply: Jeff Cochran: "Re: ASP: Get user login ID"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|