I am working on an asp.net mvc web application, and I have added the following provider to my asp.net web.config:
<system.web>
<membership>
<providers>
<add name="TestDomain1ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,Version=4.0.0.0" connectionStringName="TestDomain1ConnectionString" connectionUsername="ad-domainA.intra\it360ad.user" connectionPassword="$$$$$3" />
</providers>
</membership>
&
<add name="TestDomain1ConnectionString"
connectionString="LDAP://10.211.12.30.ad-domainA.intra/CN=Users,DC=ad-domainA,DC=intra" />
but when the users try to access the application and they enter username and password , this will raise the following exception :
Unable to establish secure connection with the server
So what might be the problem? and also is it right to include my server IP address inside the connection string as I am doing ?
EDIT
I changed my setting to be:
<system.web>
<trust level="Full" originUrl="" />
<membership>
<providers>
<add name="TestDomain1ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,Version=4.0.0.0" connectionStringName="TestDomain1ConnectionString" connectionUsername="it360ad.user" connectionPassword="$$$$$" />
</providers>
</membership>
&
<add name="TestDomain1ConnectionString"
connectionString="LDAP://ad-domainA.intra/OU=TM,DC=ad-doaminA,DC=intra" />
but currently the following check
if(domainProvider.ValidateUser(model.UserName, model.Password)
inside the Account controller action method will return
The user name or password provided is incorrect
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
MembershipProvider domainProvider;
domainProvider = Membership.Providers["TestDomain1ADMembershipProvider"];
// Validate the user with the membership system.
if (domainProvider.ValidateUser(model.UserName, model.Password))
{
//code goes here
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);
}
Can you advice why the validation will always fail ?
Thanks
Try using this connectionString="LDAP://10.211.12.30:389 />. I had the same problem and I found that I had to remove anything else after :389in the connection string.
I dont know why that is but it worked for me..... Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With