|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
collect NT domain/username
<i><b>Originally posted by : maciek (slavpapr@athenet.net)</b></i><br /><br />Request.ServerVariables("Logon_User") is supposed to provide a means of collecting the logonname of a user logged on to an NT intranet. However, this method does not appear to work across a proxy server. Is there some other method of collecting the domain/username without resorting to a login dialog?
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Peter G. (agr747@yahoo.com)</b></i><br />You say this does not work thru a proxy server but my problem is the LOGON_USER does not even work at all (in an intranet website). Here is the whole page:<br /><br /><%@ Language=VBScript %><br /><HTML><br /><HEAD><br /><title>ADSI Get user details</title><br /></HEAD><br /><BODY><br /><%<br /> sFullUser = trim(Request.ServerVariables ("LOGON_USER"))<br /> iPos = InStr(sFullUser, """)<br /> sDomain = Left(sFullUser, iPos - 1)<br /> sUser = Mid(sFullUser, iPos + 1)<br /> <br /> Set objUser = GetObject("WinNT://" & sDomain & "/" & sUser)<br />%><br /><br /><p><br />Your account is <%=sFullUser%> and your name is <%=objUser.FullName%><br /></p><br /><%<br /> set objUser = nothing<br />%><br /></BODY><br /></HTML><br /><br />The output comes down to a VBScript error and says 'Left' is an invalid invocation or argument. Once again, please note that I ran this on a local intranet with ASP 2, IIS 4, and NT Server 4 as "Administrator".
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : maciek (slavpapr@athenet.net)</b></i><br />I would include a check to see if Logon_User is empty. You will definitely get an error with the Left function if there is no whack (/). Also, have you tried displaying the server variables:<br /><%<br />For Each objItem In Request.ServerVariables<br /> Response.Write objItem & " = " & Request.ServerVariables(objItem) & "<BR>"<br />Next<br />%><br /><br />Assuming you use NTFS and merely want to check for user permission for a NT user on an intranet, you can use the MS permission checker:<br /><br /><% dim UserHasAccess<br />Set pmck = Server.CreateObject "MSWC.PermissionChecker")<br />UserHasAccess = pmck.HasAccess("./yourfile.asp")<br />If UserHasAccess Then %><br /><br /><br /><br /><br />------------<br />Peter G. at 4/8/2000 10:24:13 AM<br /><br />You say this does not work thru a proxy server but my problem is the LOGON_USER does not even work at all (in an intranet website). Here is the whole page:<br /><br /><%@ Language=VBScript %><br /><HTML><br /><HEAD><br /><title>ADSI Get user details</title><br /></HEAD><br /><BODY><br /><%<br /> sFullUser = trim(Request.ServerVariables ("LOGON_USER"))<br /> iPos = InStr(sFullUser, """)<br /> sDomain = Left(sFullUser, iPos - 1)<br /> sUser = Mid(sFullUser, iPos + 1)<br /> <br /> Set objUser = GetObject("WinNT://" & sDomain & "/" & sUser)<br />%><br /><br /><p><br />Your account is <%=sFullUser%> and your name is <%=objUser.FullName%><br /></p><br /><%<br /> set objUser = nothing<br />%><br /></BODY><br /></HTML><br /><br />The output comes down to a VBScript error and says 'Left' is an invalid invocation or argument. Once again, please note that I ran this on a local intranet with ASP 2, IIS 4, and NT Server 4 as "Administrator".
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > collect NT domain/username |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|