Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms authentication via Active Directory

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
Hi, I was trying to set up the Forms authentication via Active Directory on my test website. I followed all the instructions inside here: Unfortunately, when I try to login, I get this error message:
Error: You were not connected because a duplicate name exists on the network. Go to System in Control Panel to change the computer name and try again.
(C:\Inetpub\ line 120)

Here is my membership details in Web.config
<membership defaultProvider="MyADMembershipProvider">
<providers>
<add
name="MyADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADConnectionString"
connectionUsername="XXXXXXX\xxxx"
connectionPassword="xxxxxx"
attributeMapUsername="sAMAccountName"
/>
</providers>
</membership>

I don't know what is causing this as I'm certain the computer name is unique on the network. Can anyone help with this? Thanks in advance.
 
if your using AD as your backing store, why not implement Windows authentication (instead of Forms) and use Integrated Windows Authtentication (IIS). With this you get single sign-on when accessing the site.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thank you jmeckley for your reply.I am not storing anything in AD. What I am trying to do is to authenticate users by checking their username and password againtt AD.that is my intention and I am really new to thing thing and please let me know what I should do to do that. thank you for the help
 
Code:
<system.web>
   <identity impersonate="true" />
   <authentication mode="Windows" />
   <authorization>
     <allow roles="..." deny="..." />
     <deny roles="..." users="..." />
   </authorization>
   ...
</system.web>

<!-- if you need more refined authentiation-->
<location path="[path from root]">
   <authorization>
     <allow roles="..." deny="..." />
     <deny roles="..." users="..." />
   </authorization>
</location>

once deployed to the server. configure IIS to only use Windows Integrated Authentication. Disable all other authorization options.

once the user logs into the computer when they launch the web app they will automatically be authenticated. no need for additional log on/off.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thank you jmeckley for your reply. I will look into that.So what is the best scenerio to authenticate your application with the Active Directory. the Reson why I want to check work with the Active Directory is that I want to give to a permission for certain people to access the application. that was the reason why i wanted to use AD. I really appreciate for your time and your help for me to clarify this.
 
just put there usernames and/or roles in the appropriate attributes. DOMAIN\username or DOMAIN\groupname. asp.net will do the rest. you don't need to write any explicit code.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top