[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

How to make a login page using the Windows Autentication (ASP 3.0)

I need to make a login page in ASP 3.0 (Classic) but without using a database to store the user and password.  Instead I need to use the Windows Active Directory Authentication.
I already have the Username by Request.ServerVariables("LOGON_USER"), but I'm still missing the password authentication.  How can I program it?
0
enriquegm82
Asked:
enriquegm82
  • 6
  • 5
1 Solution
 
enriquegm82Author Commented:
Thanks for your reply.  What is LDAP and how can I obtain or capture the Domain password to compare it with the written in the textbox?
The connection string to LDAP would be the same for WinNT or Win2000 or WinXP?
0
 
golfDoctorCommented:
I just provided a link with a ton of example.  Did you review it?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
enriquegm82Author Commented:
Yes, i have review it, and I'd like to know how to get the servername, this is one of the parameters to construct the string.
0
 
golfDoctorCommented:
This is clear example use querying LDAP:
http://www.aspfree.com/c/a/ASP/Performing-Web-Authentication-and-Administration-with-LDAP/

Not sure what server name you are referring to?  You should know the name of the servers you are working with.  
0
 
enriquegm82Author Commented:
golfDoctor, this example is using a commercial component --> IP*Works! LDAP component  from /n software.
I need to do the programming in pure ASP without buying a commercial component, could you please provide me another example?
0
 
golfDoctorCommented:
Yikes, I pulled the wrong link out of the millions of other examples :)
http://www.4guysfromrolla.com/webtech/041800-1.shtml

There's a ton of exact example on this, plus the links I have provided.  You need to know the servers you are querying against, no matter what.
0
 
enriquegm82Author Commented:
Good Example golfDoctor, but It's not exactly what I need.
The user will enter his domain user and password, the same he used to log into Windows.
With the user and password, I have to validate if it's correct and grant access to the web site, if not send a message of fail authentication.
0
 
golfDoctorCommented:
You're not going to find exactly what YOU need, the goal is for you to understand how it works so you can develop it yourself.   The examples show how this works, so you can now implement it for your own purposes.
0
 
enriquegm82Author Commented:
Yes, you can golfDoctor.
Here it goes:

strUsername  = Trim(Request.Form("txtUsername"))
strPassword = Trim(Request.Form("txtPassword"))

'Get User Domain
UserDomain  = Request.ServerVariables("LOGON_USER")
User     = Right(UserDomain,(len(UserDomain)-instr(UserDomain,"\")))
strDomain  = Mid(UserDomain,1,instr(UserDomain,"\")-1)

On Error resume Next

Set oIADS = GetObject("WinNT:").OpenDSObject("WinNT://" & _
            strDomain, _
            strUsername, _
            strPassword, _
            ADS_SECURE_AUTHENTICATION)

If Err.number <> 0 Then
        'Authentication Failure
Else
        'Authentication Success!
End if
0
 
golfDoctorCommented:
He is new to the forum and doesn;t understand how it works I guess.  But I answered he question, and/or provided the resource for him to solve the problem
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now