use windows username and password on asp

N

nikou_70

I have a problem with ("auth_user") in asp,I try to use windows
username and password in asp page for limitation user access to pages,
but this server variable returns empty string, can you help me ,I
appreciate it.
 
G

Gottfried Mayer

I have a problem with ("auth_user") in asp,I try to use windows
username and password in asp page for limitation user access to pages,
but this server variable returns empty string, can you help me ,I
appreciate it.

Hi nikou_70,

You have to either deactivate the "windows logon" checkbox in the IIS
Server configuration (under Security) so that only "anonymous" and
"basic authentication" is active

or if you are using a Active Directory Domain, you can get the user
information with the ADSystemInfo Object:

Example Code:

<%
Dim oAD,oUser,strUserDN,strUserName,strFullName

Set oAD = Server.CreateObject("ADSystemInfo")
On Error Resume Next 'disable Error Checking
strUserDN = oAD.UserName
Set oAD = Nothing

If Err = 0 Then 'no error occured
On Error Goto 0 'enable Error Checking
Set oUser = GetObject("LDAP://" & strUserDN)
strUserName = oUser.SamAccountName
strFullName = oUser.FullName
Set oUser = Nothing
Response.Write "You are User [" & strFullName & _
"] with Username [" & strUserName & "]."
Else
On Error Goto 0 'enable Error Checking
Response.Write "ERROR: You are no Active Directory User!"
End If
%>


HTH
Gottfried
 
B

Bob Barrows [MVP]

Gottfried said:
Hi nikou_70,

You have to either deactivate the "windows logon" checkbox in the IIS

No, he wants to use "windows usename" Why would you advise him to deactivate
the windows logon checkbox??

He has to turn off Anonymous Access in order to see anything in "auth_user"
or "logon_user", which is the one I use.
or if you are using a Active Directory Domain, you can get the user
information with the ADSystemInfo Object:

That's not true.
 
B

Bob Barrows [MVP]

I have a problem with ("auth_user") in asp,I try to use windows
username and password in asp page for limitation user access to pages,
but this server variable returns empty string, can you help me ,I
appreciate it.

You forgot to diable "Anonymous" access in IIS Manager.
I prefer to use "logon_user", but "auth_user" should work as well.

Bob Barrows
 
G

Gottfried Mayer

Bob said:
No, he wants to use "windows usename" Why would you advise him to deactivate
the windows logon checkbox??

He has to turn off Anonymous Access in order to see anything in "auth_user"
or "logon_user", which is the one I use.




That's not true.

Hi Bob,

You're right, of course...

If you only want authenticated users to access your page (anonymous
users from outside your company will have to log on before they see
anything), you just have to deactivate the "anonymous access" in IIS

I'm currently working on a project that uses mixed
anonymous/authenticated Access to display different (public and
internal) data, there I had to configure IIS like I stated in my last
post, and I used the ADSystemInformation to get the current user (with
Group membership and the whole show...)

Maybe I am a bit confused right now.

Gottfried
 
B

Bob Barrows [MVP]

Gottfried said:
I'm currently working on a project that uses mixed
anonymous/authenticated Access to display different (public and
internal) data, there I had to configure IIS like I stated in my last
post, and I used the ADSystemInformation to get the current user (with
Group membership and the whole show...)

Ahh, that explains it...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top