Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 13, 2013 11:26 AM by dwernle
Nov 19, 2012 08:51 PM|LINK
Hi all, First post here on asp.net. If I need to provide additional information to the problem, please let me know as this is my first attempt to authenticate against an AD server.
I have a intranet web project that I'm trying to get setup to use AD authentication. I think I have everything setup except when I run the application and try to login, I get the error "invalid username and/or password".
When I try to access an anonymously allowed controller action and try to access the membership provider, I get the following exception:
System.Configuration.ConfigurationErrorsException was unhandled Message=Could not load type 'System.Web.Providers.ActiveDirectoryMembershipProvider'.
Any thoughts on why this exception is being thrown? Any help would be greatly appreciated!
Nov 19, 2012 08:56 PM|LINK
In IIS, under your application, under the IIS section, go into Authentication. Make sure Windows Authentication is the only one enabled.
Nov 19, 2012 11:14 PM|LINK
Thanks for replying so soon!
Where might I check on these settings when using VS2010 and IIS Express (in development)?
Nov 19, 2012 11:48 PM|LINK
You shoould check on Project Properties on Section Web : NTLM Authentication.
Nov 20, 2012 02:17 PM|LINK
Unfortunately when I open up the project properties and look under the Web section, there is no NTLM Authentication. I am using Visual Studio 2010 with IIS Express. Any ideas?
Thanks for your help!
Nov 20, 2012 02:51 PM|LINK
Could you maybe post your web.config file with the membership provider and the LDAP connection string? Have you made sure that you have provided the correct defaultProvider value?
Hope it helps
Nov 20, 2012 03:01 PM|LINK
Below is what I have in web.config for this project (connection credentials are **'ed out):
<add name="ADConnectionString" connectionString=LDAP://**adservername**/DC=**networkdomain** />
<add name="AD_MembershipProvider" type="System.Web.Providers.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" connectionUsername="**networkdomain**\administrator" connectionPassword="**adminpwd**"
Nov 20, 2012 03:06 PM|LINK
Looks all good to me! Am not trying to be cocky, but have you debugged the logon action method?
Nov 20, 2012 03:17 PM|LINK
Not cocky at all; I have debugged the following controller action:
Public Function Login(model As LoginModel, returnUrl As String) As ActionResult
If ModelState.IsValid AndAlso FormsAuthentication.Authenticate(model.UserName, model.Password) Then
' If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.")
From what I find when debugging, the "FormsAuthentication.Authenticate" method returns false. Is there perhaps something I'm missing here that I can step through to find out exactly why it's returning false?
Nov 20, 2012 03:29 PM|LINK
Well for the Default Web Development Server NTLM Authentication exists, it's also possible to create a website on your local IIS and attach the project to it through VS
I guess that's better than putting all the configuration and exposing password in the web.config file and also it will be useless when you deploy it, because Windows Authentication is a part of IIS.