Hi, I hope you guys can help me.
I need to build a form that request username and password on ASP not ASP.net (sorry to clarify but i got some responses in other forums in .net)
This form will send an LDAP query into the active directory located on a different server and it will check for existing users.
If the users exist they will be redirected to a new page. if not they will be prompt to try again for username and password.
What is happening I am gett authentication failed all the time. I know i am a user but I dont know why I am not being redirected to the page i need.
could it be that the server is using another way of saving the users other than LDAP or Active directory?
To be more specific. People are being added to an Xchange server for email purposes. This creates a username (email) and a password. Giving them access to a webmail.
how can i compare this list of users using this code.
the form i am working with is this -
<%
-
dim submit
-
dim UserName
-
dim Password
-
-
UserName = ""
-
Password = ""
-
Domain = "domain.com"
-
-
submit = request.form("submit")
-
-
if submit = "Authenticate" then
-
UserName = request.form("UserName")
-
Password = request.form("Password")
-
Domain = request.form("Domain")
-
result = AuthenticateUser(UserName, Password, Domain)
-
if result then
-
Response.Write("<script>window.open('../forms/default.asp','');</script>")
-
else
-
response.write "<h3>Authentication Failed!</h3>"
-
end if
-
end if
-
-
response.write "<hr><form method=post>"
-
response.write "<table>"
-
response.write "<tr>"
-
response.write "<td><b>Username: </b></td><td><input type='text'"
-
name="'UserName' value='' & UserName & '' size='30'></td>"
-
response.write "</tr>"
-
response.write "<tr>"
-
response.write "<td><b>Password: </b></td><td><input type='password' name='Password' value='' & Password & '' size='30'></td>"
-
response.write "</tr>"
-
response.write "<tr>"
-
response.write "<td><b>AD Domain: </b></td><td><input type='text' name='Domain' value='' & Domain & '' size='30'></td>"
-
response.write "</tr>"
-
response.write "<tr>"
-
response.write "<td> </td><td><input name='submit' type='submit' value='Authenticate'></td>"
-
response.write "</tr>"
-
response.write "</table>"
-
response.write "</form>"
-
response.end
-
-
function AuthenticateUser(UserName, Password, Domain)
-
dim strUser
-
' assume failure
-
AuthenticateUser = false
-
-
strUser = UserName
-
strPassword = Password
-
-
strQuery = "SELECT cn FROM 'LDAP://" & Domain & "' WHERE objectClass='*' "
-
set oConn = server.CreateObject("ADODB.Connection")
-
oConn.Provider = "ADsDSOOBJECT"
-
oConn.Properties("User ID") = strUser
-
oConn.Properties("Password") = strPassword
-
oConn.Properties("Encrypt Password") = true
-
oConn.open "DS Query", strUser, strPassword
-
-
set cmd = server.CreateObject("ADODB.Command")
-
set cmd.ActiveConnection = oConn
-
cmd.CommandText = strQuery
-
on error resume next
-
set oRS = cmd.Execute
-
if oRS.bof or oRS.eof then
-
AuthenticateUser = false
-
else
-
AuthenticateUser = true
-
-
end if
-
set oRS = nothing
-
set oConn = nothing
-
-
end function
-
-
%>
5 5487 CroCrew 564
Recognized Expert Contributor
Hello wak0,
Question: Is the web server in the domain? Or is it a standalone web server?
CroCrew~
stand alone. Thanks for replying
CroCrew 564
Recognized Expert Contributor
Hello wak0,
Since you are doing a server-less bind to Active Directory, ADSI tries to pick up the domain to use based on the current security context of the executing thread. In ASP, impersonation is always used.
Try to add “/rootDSE” after your domain name:
LDAP://domain.com/rootDSE
In general, if the web server was within the domain, I'd suggest using Windows authentication instead. Windows Authentication allows you to avoid this mess and will give you better scalability.
Consider going down this path if Windows Authentication is absolutely not a possibility: -
Set objDSObj = GetObject("LDAP:")
-
Set objAuth = objDSObj.OpenDSObject("LDAP://domain.com/rootDSE",
-
strDomainUser, strPassword, 1)
-
Hope that it helps,
CroCrew~
that is what i found out. thanks for the tip. will implement and check back
CroCrew 564
Recognized Expert Contributor
Let us know if it works out for ya. It could help the next person.
Good luck,
CroCrew~
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Victor Lokhmatov |
last post by:
Hello Everyone,
My company has asked me to put a company directory on our intranet site
and I'm trying to use php to extract the users from our active
directory server. I've got everything working, however, when the list
of users is shown in the output, it seems to display the users in the
order their accounts were created, with Administrator obviously being
first. What do you think would be the best way to get the list to be
sorted by...
|
by: dmcconkey |
last post by:
Hi folks,
I've been searching for a while and haven't found my specific question
anywhere else. If this has already been asked, please accept my
appologies and point me to the appropriate thread.
I'm bidding on a PHP intranet development contract. One of the specific
requirements is that the app interface with the company's existing Open
LDAP server for user authentication.
|
by: Amar |
last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap
does not have security as it returns only user demographic information.
i do not need to bind with a username or credentials.
What i am trying to do is, i am trying to look up all the information for
the user with user id 'testuser'. The following is the Vb.net code for my
aspx page:
Dim oRoot As DirectoryEntry = New...
|
by: mrwoopey |
last post by:
Hi,
I am using the example "Authenticate against the Active Directory by
Using Forms Authentication and Visual Basic .NET":
http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340
But I am having a problem figuring out the LDAP://
The LDAP:// that I pass looks like this (i substitued generic the
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
| |
by: Ganesh Ramamurthy |
last post by:
Hi Experts,
I am using windows Authenication in my ASP.Net application. I have different
LDAP's configured in my network and my applicaiton uses one of these LDAP
users. How can I specify IIS to use one of these LDAP for user
authentication. Is there any way of instructing the IIS to do so?
Thanking in advance
Regards
|
by: Serge |
last post by:
Good Day Folks,
I'm trying to do an LDAP search of Novell eDirectory, but I'm getting a
compile error.
The error and my code are listed below.
Any ideas ?
Thanks in advance
/Serge
|
by: P Webster |
last post by:
We recently moved a web site that validated user credentials in Active
Directory from IIS 5.1 to IIS 6, and the validation code no longer works.
The web.config file is set to Windows authentication because all we do is
verify the user on the login form so we can redirect them to the appropriate
page based on their group.
The code to authenticate is:
Public Function IsAuthenticated(ByVal domain As String, ByVal username As
String, ByVal...
|
by: duncan beaumont |
last post by:
Hi,
- SQLserver 2000
- Yellowfin 2.4
- Windows 2003 server
I have been asked to investigate seting up LDAP authentication to
access our
Yellowfin reporting.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |