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
%> 6 4435 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 %>
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 %>
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 %>
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 %>
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 > %> > > >
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 > %> > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 query the Active directory by
using the IP address in the incoming web request and trying to figure...
|
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
just check a cached version of the request (since the page loads very
fast). If however the user...
|
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 happenning? Whe nwe run the DLL from VB6 or
|
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++ but these are not using
DotNet and dont give any hint to a property that may be used. They seem...
|
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"
exception.
This happens when calling the ManagementScope.Connect() method.
| |
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 store in session state.
|
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 LDAP modify operation to successfully change the password. As
far as i know eDirectory schema does...
|
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 not find). What have I done wrong?
I have included the function below that works in ever respect...
|
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
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |