Wrox Home  
Search P2P Archive for: Go

  Return to Index  

security_asp thread: validate a user's login through AD


Message #1 by "Johan Sundstrom" <johan.sundstrom@m...> on Sun, 3 Mar 2002 19:19:40
Please send plain text only to the lists, not HTML or MIME encoded mail.
Set your mail client to always use plain text, not to reply as received.

Stephen

"Johan Sundstrom" <johan.sundstrom@m...> wrote in message
news:155063@s..._asp...
>
> Hi Mike
>
> and thanks for an interesting piece of code. For some reason there's a lot
> of misplaced characters in your answer which I don't blame you for, must
> be a Wrox-bug.
>
> Can you please send send me your e-mailaddress so I can send you a code
> back. My e-mail i johan.sundstrom@m...
>
> Bye Johan
>
> > Here's a piece of code I have used to validate a user's password before

> > setting it. You'll have to modify the UPN to be the AD location of your

> > particular user objects, including the AD domain name. Also note that 
> > you'll need to include the typelib definition <!--METADATA 
> > TYPE=3D"TypeLib" UUID=3D"{97D25DB0-0363-11CF-ABC4-02608C9E7553}"--> 
> > either in the page that uses this code, or in the global.asa for the 
> > application. This allows you to use the built-in constants when opening

> > objects.
> >
> > Hope this helps,
> >
> > Mike Peschka
> >
> >
> > Here's the code...
> >
> >   On Error Resume Next
> >
> >   Dim userCN, objUser
> >   userUPN =3D "CN=3D" & Request("Username") & 
> > ",OU=3DUsers,DC=3Dtestdomain,DC=3Dcom"
> >   Set objUser =3D GetObject("LDAP://" & userUPN)
> >   If Err.Number <> 0 Then
> >     ErrMessage =3D "The username entered could not be found in the 
> > domain."
> >     Response.Write ErrMessage
> >     Response.End
> >     Err.Clear
> >   End If
> >   Set objUser =3D Nothing
> >
> >   Set objDSOpen =3D GetObject("LDAP:")
> >   Set objUser =3D objDSOpen.OpenDSObject("LDAP://" & userUPN, userUPN, 
> > Request("curpass"), ADS_SECURE_AUTHENTICATION)
> >   If Err.Number <> 0 Then
> >     ErrMessage =3D "The current password you entered for " & 
> > Request("username") & " is invalid."
> >     Response.Write ErrMessage
> >     Response.End
> >     Err.Clear
> >   End If
> >   ' At this point, the user is validated.
> >
> >
> > -----Original Message-----
> > From: Johan Sundstrom [mailto:johan.sundstrom@m...]
> > Sent: Sunday, March 03, 2002 2:20 PM
> > To: Security_asp
> > Subject: [security_asp] validate a user's login through AD
> >
> >
> > I would like to validate a user's login through AD.
> >
> > That is I have a ASP-page that requests the users username and
> password
> > and instead of validate through a seperate database, I would like to ask
> 
> >
> > AD i win2000. This is possible in Novells NDS, but I like to validate 
> > from
> > AD instead.
> >
> > Help anyone?
> >
> > Johan Sundstr=F6m
> >
> > $subst('Email.Unsub').
>
>



  Return to Index