473,574 Members | 3,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADSI

Hi,

I have found some code that authenticates users agains a domain using ADSI.
I then redirect to another page and pass the username they have entered as a
string. However, it would be nice to also get their full name from Active
Directory once authenticated. Can anyone suggest how I may modify this code
to achieve this? I would also like to pass their full name to the next page
as a string. The code I found:

<%

if (not strADsPath= "") then

' bind to the ADSI object. If user has supplied a username, then
' authenticate too
strADsPath = "WinNT://" & strADsPath
Dim oADsObject
Dim tempstr
tempstr = strDomain & "\" & strUserName
Set oADsObject = GetObject(strAD sPath)
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
set oADsNamespace = GetObject(strAD sNamespace)

Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
strPassword, 0)

' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
Response.Write "Login Failed, please try again</strong><br>"

else
'If the password is correct then set the session variable to True
Session("blnIsU serGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name

response.redire ct "success.asp?us ername="&strUse rName
%>

Jul 19 '05 #1
6 4417
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Hi,

I have found some code that authenticates users agains a domain using ADSI. I then redirect to another page and pass the username they have entered as a string. However, it would be nice to also get their full name from Active
Directory once authenticated. Can anyone suggest how I may modify this code to achieve this? I would also like to pass their full name to the next page as a string. The code I found:

<%

if (not strADsPath= "") then

' bind to the ADSI object. If user has supplied a username, then
' authenticate too
strADsPath = "WinNT://" & strADsPath
Dim oADsObject
Dim tempstr
tempstr = strDomain & "\" & strUserName
Set oADsObject = GetObject(strAD sPath)
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
set oADsNamespace = GetObject(strAD sNamespace)

Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
strPassword, 0)

' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
Response.Write "Login Failed, please try again</strong><br>"

else
'If the password is correct then set the session variable to True
Session("blnIsU serGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name

response.redire ct "success.asp?us ername="&strUse rName
%>

Jul 19 '05 #2
Thanks Tom,

After checking that article I added the following code and it works a treat.
Thanks again.

Dim FullName
Dim User
Set User = GetObject("WinN T://" & strDomain & "/" & strUserName & ",user")
FullName = User.Fullname
"Tom B" <sh*****@hotmai l.com> wrote in message
news:#e******** *****@TK2MSFTNG P10.phx.gbl...
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Hi,

I have found some code that authenticates users agains a domain using ADSI.
I then redirect to another page and pass the username they have entered as a
string. However, it would be nice to also get their full name from

Active Directory once authenticated. Can anyone suggest how I may modify this

code
to achieve this? I would also like to pass their full name to the next

page
as a string. The code I found:

<%

if (not strADsPath= "") then

' bind to the ADSI object. If user has supplied a username, then
' authenticate too
strADsPath = "WinNT://" & strADsPath
Dim oADsObject
Dim tempstr
tempstr = strDomain & "\" & strUserName
Set oADsObject = GetObject(strAD sPath)
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
set oADsNamespace = GetObject(strAD sNamespace)

Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
strPassword, 0)

' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
Response.Write "Login Failed, please try again</strong><br>"

else
'If the password is correct then set the session variable to True
Session("blnIsU serGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name

response.redire ct "success.asp?us ername="&strUse rName
%>


Jul 19 '05 #3
Is it possible to retrieve the email address as well

any help
"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Thanks Tom,

After checking that article I added the following code and it works a treat. Thanks again.

Dim FullName
Dim User
Set User = GetObject("WinN T://" & strDomain & "/" & strUserName & ",user") FullName = User.Fullname
"Tom B" <sh*****@hotmai l.com> wrote in message
news:#e******** *****@TK2MSFTNG P10.phx.gbl...
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Hi,

I have found some code that authenticates users agains a domain using ADSI.
I then redirect to another page and pass the username they have
entered as
a
string. However, it would be nice to also get their full name from

Active Directory once authenticated. Can anyone suggest how I may modify this

code
to achieve this? I would also like to pass their full name to the next

page
as a string. The code I found:

<%

if (not strADsPath= "") then

' bind to the ADSI object. If user has supplied a username, then
' authenticate too
strADsPath = "WinNT://" & strADsPath
Dim oADsObject
Dim tempstr
tempstr = strDomain & "\" & strUserName
Set oADsObject = GetObject(strAD sPath)
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
set oADsNamespace = GetObject(strAD sNamespace)

Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
strPassword, 0)

' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
Response.Write "Login Failed, please try again</strong><br>"

else
'If the password is correct then set the session variable to True
Session("blnIsU serGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name

response.redire ct "success.asp?us ername="&strUse rName
%>



Jul 19 '05 #4
http://www.15seconds.com/issue/020130.htm

That's the one I meant.

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Thanks Tom,

After checking that article I added the following code and it works a treat. Thanks again.

Dim FullName
Dim User
Set User = GetObject("WinN T://" & strDomain & "/" & strUserName & ",user") FullName = User.Fullname
"Tom B" <sh*****@hotmai l.com> wrote in message
news:#e******** *****@TK2MSFTNG P10.phx.gbl...
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Hi,

I have found some code that authenticates users agains a domain using ADSI.
I then redirect to another page and pass the username they have
entered as
a
string. However, it would be nice to also get their full name from

Active Directory once authenticated. Can anyone suggest how I may modify this

code
to achieve this? I would also like to pass their full name to the next

page
as a string. The code I found:

<%

if (not strADsPath= "") then

' bind to the ADSI object. If user has supplied a username, then
' authenticate too
strADsPath = "WinNT://" & strADsPath
Dim oADsObject
Dim tempstr
tempstr = strDomain & "\" & strUserName
Set oADsObject = GetObject(strAD sPath)
Dim strADsNamespace
Dim oADsNamespace
strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
set oADsNamespace = GetObject(strAD sNamespace)

Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
strPassword, 0)

' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
Response.Write "Login Failed, please try again</strong><br>"

else
'If the password is correct then set the session variable to True
Session("blnIsU serGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name

response.redire ct "success.asp?us ername="&strUse rName
%>



Jul 19 '05 #5
This page
http://msdn.microsoft.com/library/de...i/iadsuser.asp
suggests a property called emailaddress
where do they get these crazy names.
"J P Singh" <noemail@asIhat espam> wrote in message
news:eH******** ******@TK2MSFTN GP09.phx.gbl...
Is it possible to retrieve the email address as well

any help
"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Thanks Tom,

After checking that article I added the following code and it works a

treat.
Thanks again.

Dim FullName
Dim User
Set User = GetObject("WinN T://" & strDomain & "/" & strUserName &

",user")
FullName = User.Fullname
"Tom B" <sh*****@hotmai l.com> wrote in message
news:#e******** *****@TK2MSFTNG P10.phx.gbl...
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
> Hi,
>
> I have found some code that authenticates users agains a domain using ADSI.
> I then redirect to another page and pass the username they have

entered
as
a
> string. However, it would be nice to also get their full name from

Active
> Directory once authenticated. Can anyone suggest how I may modify this code
> to achieve this? I would also like to pass their full name to the next page
> as a string. The code I found:
>
> <%
>
> if (not strADsPath= "") then
>
> ' bind to the ADSI object. If user has supplied a username, then
> ' authenticate too
> strADsPath = "WinNT://" & strADsPath
> Dim oADsObject
> Dim tempstr
> tempstr = strDomain & "\" & strUserName
>
>
> Set oADsObject = GetObject(strAD sPath)
>
>
> Dim strADsNamespace
> Dim oADsNamespace
> strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
> set oADsNamespace = GetObject(strAD sNamespace)
>
> Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
> strPassword, 0)
>
> ' we've only managed to bind if err.number = 0
> if not (Err.number = 0) then
> Response.Write "Login Failed, please try again</strong><br>"
>
> else
> 'If the password is correct then set the session variable to True
> Session("blnIsU serGood") = True
>
> 'Close Objects before redirecting
> Set adoCon = Nothing
> Set strCon = Nothing
> Set rsCheckUser = Nothing
>
> 'Redirect to the authorised user page and send the users name
>
> response.redire ct "success.asp?us ername="&strUse rName
> %>
>
>
>



Jul 19 '05 #6
And this looks interesting..
http://www.4guysfromrolla.com/webtech/041800-1.shtml

"J P Singh" <noemail@asIhat espam> wrote in message
news:eH******** ******@TK2MSFTN GP09.phx.gbl...
Is it possible to retrieve the email address as well

any help
"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
Thanks Tom,

After checking that article I added the following code and it works a

treat.
Thanks again.

Dim FullName
Dim User
Set User = GetObject("WinN T://" & strDomain & "/" & strUserName &

",user")
FullName = User.Fullname
"Tom B" <sh*****@hotmai l.com> wrote in message
news:#e******** *****@TK2MSFTNG P10.phx.gbl...
http://www.15seconds.com/issue/011127.htm
refers to User.fullname under
"Changing User-Properties"

"Miguel Orrego" <mi****@stresse dmonkey.net-nospam> wrote in message
news:3f******** *************@n ews.dial.pipex. com...
> Hi,
>
> I have found some code that authenticates users agains a domain using ADSI.
> I then redirect to another page and pass the username they have

entered
as
a
> string. However, it would be nice to also get their full name from

Active
> Directory once authenticated. Can anyone suggest how I may modify this code
> to achieve this? I would also like to pass their full name to the next page
> as a string. The code I found:
>
> <%
>
> if (not strADsPath= "") then
>
> ' bind to the ADSI object. If user has supplied a username, then
> ' authenticate too
> strADsPath = "WinNT://" & strADsPath
> Dim oADsObject
> Dim tempstr
> tempstr = strDomain & "\" & strUserName
>
>
> Set oADsObject = GetObject(strAD sPath)
>
>
> Dim strADsNamespace
> Dim oADsNamespace
> strADsNamespace = left(strADsPath , instr(strADsPat h, ":"))
> set oADsNamespace = GetObject(strAD sNamespace)
>
> Set oADsObject = oADsNamespace.O penDSObject(str ADsPath, tempstr,
> strPassword, 0)
>
> ' we've only managed to bind if err.number = 0
> if not (Err.number = 0) then
> Response.Write "Login Failed, please try again</strong><br>"
>
> else
> 'If the password is correct then set the session variable to True
> Session("blnIsU serGood") = True
>
> 'Close Objects before redirecting
> Set adoCon = Nothing
> Set strCon = Nothing
> Set rsCheckUser = Nothing
>
> 'Redirect to the authorised user page and send the users name
>
> response.redire ct "success.asp?us ername="&strUse rName
> %>
>
>
>



Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7366
by: Akhlaq Khan | last post by:
we are developing an intranet application (web based) which needs to detect the logged in user ID of the user hitting the website. the intranet is huge and based on win2k active directory (around 20-30 different domains) with 25K+ users. i dont want to use "NT challenge response" for this pupose. I am exploring ways using ADSI and WMI to...
1
1649
by: Ryan Ritten | last post by:
I was wondering if anyone knew how (or if it's even possible) to cache the results of an ADSI call in asp for a longer period of time. Basically what I am doing is I have a website that loads the 'full name' of the user that logs into it. Once the user full nam ehas been retreived (using adsi) the user can reload the page and it appears to...
2
2442
by: Enigma Webmaster | last post by:
Hi All, We've written a couple of functions which, when run in VB6 work fine and allow AD users to be updated. When we include the code into an ASP Page and try and update a users information (i.e. Mobile Phone Number) we get a failure as below... Error Number:- -2147467259 Automation error Unspecified error Can anyone see why this is...
14
5207
by: Arran Pearce | last post by:
Hi, I am looking for a way to use System.DirectoryServices to find all users on a domain whos accounts are either locked out or disabled. I have used ADSIEdit and the mmc schema add-in to try and find properties for these things but have not had any luck so far. Also i did a search on the Platform SDK doc's. It has examples in VB and C++...
3
3627
by: Roy Osherove | last post by:
Hi folks. I have an ASP.Net application that runs a .Net dll that uses WMI and ADSI(both managed) to connect to a given IIS root and search through it. When not using the ASP.Net client, but running from a winforms project - I can connect to both local and remote machines. However, when using the ASP.Net project - I get an "Access denied"...
8
1784
by: msnews.microsoft.com | last post by:
I have ADSI code that I can make work at the command line. I cannot in any way get it to work in asp.net. Even using Windows authentication, impersonation on, and providing the credentials hardcoded, I cannot make this same code happen. This is all I am trying to do: static void Stuff() { //we don't need the credentials on this form // so...
3
2229
by: chat_devil | last post by:
hi, does anyone know if it is possible to remove an attribute that can not be read into the ADSI property cache/collection. i'm trying to do an eDirectory password change from .net directory services. eDirectory uses the "userPassword" property to change the password and for a normal user, this has to be deleted and then added to in one...
1
2581
by: LittlePython | last post by:
I am a little confused on why I can not detect an object that does not exist with a try and except. If I understand ADSI correctly from what I have read you do not create these objects but rather get them. They already exist. I believe if I do the equivalent in VB I would generate an error when I try to get an object that does not exist (can...
8
3122
by: John | last post by:
Hi, gurus, How can I implement the following feature in C#: Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ", group") For Each objMember In objGroup.Members WScript.Echo vbCrLf & " Name: " & objMember.Name Next
0
7764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8140
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6514
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3776
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.