Current location: Hot Scripts Forums » Programming Languages » ASP » authenticate Active Directory Users


authenticate Active Directory Users

Reply
  #1 (permalink)  
Old 10-06-05, 05:59 PM
wajeeh_r wajeeh_r is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Karachi, Pakistan
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation authenticate Active Directory Users

Hello all!

I have a domain ‘test’ created on win 2003 server. 5 users are created in the Active directory. I want to know how I can authenticate active directory users through ASP code.

I want something like this that when a user enters IP in browser to use intranet he should be presented with a screen in which he has to enter his username and password as created in active directory. This entered information is to be authenticated by ASP code by contacting Active directory that whether the user with this name exists or not. If yes then the user should be presented with a welcome screen.

Regards,
Wajeeh ur rahman
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-07-05, 11:56 AM
koncept
Guest
 
Posts: n/a
you will need to look into ldap. i do not know much about using that from asp, but it will be comming up in a project soon.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-12-05, 08:33 AM
chuck59 chuck59 is offline
Newbie Coder
 
Join Date: Oct 2005
Location: Karachi
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
You can not accomplish it with ASP. As ASP is a scripting language and no system progrmming could be done with it (system interaction), however if you want to do some operations with WinAPI, you'll need to build an ActiveX DLL and call it's public function from your ASP code.
In current scenario, where you need to authenticate a user with Active Directory, you'll need to develop an ISAPI filter for IIS. This filter shall be activated on whole of the IIS or on a site, where you need to enable this functionality.

Important: An ISAPI filter could not be programmed in VB6, but you'll have to develop it with VC++ or .NET.

Following are some URL, which will give a brief overview of ISAPI filters...

. ISAPI authentication filter
. ISAPI filter to allow access only to hosts with selected IP addresses

You can also search for "ISAPI filter" at http://www.codeproject.com to find more examples.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-26-05, 08:00 AM
toth toth is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
I know how to do this with an Acces database, donno how to do it with an active directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-31-05, 04:19 PM
elm_st elm_st is offline
New Member
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Validate AD Credentials via Classic ASP Code

Here is the function I use to validate our Active Directory Credentials via an ASP Page. It's a bit crude, but it works...

if validateuser("domainname\aduser","x")=0 then 'User/Password is correct.
Code:
function validateuser(username,password)
    dim ad_con
    dim ad_Com
    dim ad_rs
 
    on error resume next
    domainname=mid(username,1,instr(username,"\")-1)' "
 
    err.clear
 
    Set ad_con = Server.CreateObject("ADODB.Connection")
 
    ad_con.provider ="ADsDSOObject"
    ad_con.properties("user id")=username
    ad_con.properties("password")=password
    ad_con.open "Active Directory Provider"
    Set ad_Com = CreateObject("ADODB.Command")
    Set ad_Com.ActiveConnection = ad_con 
 
    ad_Com.CommandText = "select sn from 'LDAP://"&domainname&"' WHERE objectCategory='user' "
    Set ad_rs = ad_Com.Execute 
 
    validateuser=err
 
    ad_rs.close
    ad_con.close
 
    set ad_rs=nothing
    set ad_com=nothing
    set ad_con=nothing
end function

Last edited by digioz; 05-03-09 at 04:00 PM. Reason: Please use code tags.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 04-27-09, 12:36 PM
ateris ateris is offline
New Member
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,
I seem to be getting a permission error on Set ad_rs = ad_Com.Execute. Could anyone help me why I am getting that.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Directory Error ziadn ASP 2 11-17-05 01:32 AM
PHP & MS Active Directory djwayne_2004 PHP 0 02-07-05 06:51 PM
OWA / Active Directory phillips_k Visual Basic 0 02-15-04 01:34 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 07:02 AM
? on users accessing a directory mdhall PHP 10 10-18-03 01:25 PM


All times are GMT -5. The time now is 10:32 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.