.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Active Directory Authentication with Login Control ASP.Net 3.5 or 4

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

Hello, I am trying to follow instructions on how to create a login page that tests against active directory.  My issue is all of the tutorials seem to be written for ASP.NET 2.0.  When I try to follow them I cannot get them to work.  Does anyone have any tutorial or information for .NET 3.5 or 4.0?


View Complete Post

More Related Resource Links

Login authentication using Active Directory for ASP.NET applications

This article explains how to authenticate the users while login into asp.net application against active directory in a simple way.

Authentication With Active Directory AD Getting properties


Authentication with AD is just a call to the predefined function.. Surprised
you just need following references:Embarassed

using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;

and one dll:
using UserAuthentication; //dll that you need to be download.. search for it from our god: googleWink


string adPath = "LDAP://" + System.Configuration.ConfigurationSettings.AppSettings["DefaultActiveDirectoryServer"];
ActiveDirectoryValidator adAuth = new ActiveDirectoryValidator(adPath);
if (adAuth.IsAuthenticated(domainName, userName, password))
//user is authenticated with the given username and password<br/></div></div><div class=

Forms authentication and Active Directory? Help!

Hi, im new to sharepoint 2010. im in a situation whereby i would like to allow users that already have Active directory accounts log into sharepoint. The problem arises when i need to allow external users to log into the sharepoint site too and it will not be possible to add them into the active directory. Is there a way to resolve this problem? Appreciate all help given! Thanks! norphos

Active Directory user impersonation with forms authentication

I've written a small ASP.NET 3.5 application to allow users to update selected account attributes on their own. Everything works fine when I use Basic Authentication, but because the dialog that is presented is less than ideal, I'd like to use forms authentication to give the users more instruction on how to log in. My problem is that in order for the user to update their account information, I have to have the application impersonate them for the update actions. I've scoured the internet trying to find a solution to my issue, but nothing fits or works. I have tried setting the web.config:<identity impersonate="true" /> but that doesn't seem to work. I also have the C# code using the WindowsImpersonationContext class, but still no luck. protected void titleTextBox_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; string fieldTitle = "job title"; string fieldName = "title"; if (userDirectoryEntry == null) CaptureUserIdentity(); try { WindowsImpersonationContext impersonationContext = userWindowsIdentity.Impersonate(); if (String.IsNullOrEmpty(tb.Text)) userDirectoryEntry.Properties[fieldName].Clear();

MVC Forms Authentication With Active Directory

Hi there,I am just getting started with MVC and I was wondering if someone could point me in the right direction for help with forms authentication using active directory? I have the sample site up but the results I have found on google have not been very helpful in answering this question.This site is going to be an intranet page that we want users to be able to access without logging in when they access it from our network while they must login when trying to access it from home.Any suggestions of where to start?

Changing an authentication of SharePoint site from SQL-FBA to Active Directory

Hi,      We are using MOSS 2007. I have customized a web application using Custom web part, features and ASPX pages. we have configured SQL-Form based Authentication for this site. I have also used FBA user management functionality from Codeplex. I have created some groups and my application (custom aspx page) is referencing these groups to send an email to specific person as per his role for certail events.        I have a requirement to migrate this set up on other server and change the authentication from SQL-FBA to Active Directory. So if I have to change the Authentication from SQL-FBA to AD then what are the steps I have to follow to make this happen?      I would appreciate any help on this. Thanks, Patav    

Active Directory login

We will put the active directory logon when the user access the website, the user needs to fill in his user name and password.How do we store/get the details of the logon user once the user is logged in?

Create SQL Login that utilized Active Directory

Hello SQL Guru, I’m newbie to create SQL Login that utilized Active Directory. I have a SQL Server 2008 Enterprise edition 64-bits that runs in Window Server 2008 R2 Standard Edition 64-bit operating Systems. I configured  the SQL Server 2008 with Window Authentication. Then, I login with built-in Administrator account into computer and connected to my SQL Server 2008.  e.g: Object Explorer displayed COMPUTER NAME\Database Instance Name (SQL Server 10.0.2531 – COMPUTER NAME\Admin Account) Then, I created SQL login on the following: USE AccountingDatabase;GO CREATE USER  DomainName\User Name FOR LOGIN DomainName\User NameGO EXEC sp_addrolemember N’db_datareader’, N’DomainName\User Name’GO I tested it out and the specific login still did not have an access to specific database instance  e.g: “AccountingDatabase” Also, I did not see the “User Mapping” under properties checked/assigned to those specific user. Can anyone help and give me light on best practice. Thanks,Edwin

Small site embedded login validating against Active Directory and redrecting to SharePoint site


I am only finding pieces of this information. 

Challenge: Have a standard page with a login box in the corner that is exposed on the web.  The login will validate an employee against AD and also redirect them to a site collection.

I have found information on claims based authentication and the AD Membership provider.  I have also found information on form based login pages.  Most of these examples though just modify the SharePoint form login.  I want to create just a small login box on a page that is already created.  The one thing that I can't seem to find any really solid information on is the redirect to a site collection.

Can anyone tie all of this together for me?  Am I using the correct terminology and heading down the right path.

Any help is greatly appreciated.

changing active directory login name

So the guys at my company have been changing the AD login names for women that get married. For example Jenny Smith got married to Bob Right, AD\jsmith changes to AD\jright.  This doesn't cause any problems until we changed servers and used microsoft's login transfer script.  It scripts out Jenny's login as AD\jsmith, and then when you run the script it says:

Msg 15401, Level 16, State 1, Line 3
Windows NT user or group 'AD\jsmith' not found. Check the name again.

I know someone else has had to deal with this, is this just a bug?

also if i were to add AD\jright when AD\jsmith is already on the server it says AD\jright is already added to the security.

intranet site authentication against Active Directory


Hi all,

I am trying to build a web app for an intranet site that for security reasons needs to make the user type in their Windows or Active Directory username pwd manually. I have previously worked with Integrated Windows Auth but in this case, we do want them to use type in their AD credentials. 

I have been trying to look up how to do this and frankly I am a bit lost. It should be a fairly straightforward task and am hoping you can point me in the right direction, with some tutorials or examples. We will be using SSL so, dont have to worry about passing pwd in cleartext over the wire. 

My environment is visual studio 2008 in C#, .net 3.5 if that matters.

Any pointers ? Thank you. 

Login Control Authentication



I have attached membership functionality to my asp.net application and sql server. I was able to create different roles and users through asp.net website admin. tool. Now, I am trying to login as user. If I enter wrong password, login control gives me message. In my code behind, I am trying to redirect the user in the login1_loggedin method but when I check the property of "User" to find the name or Userinrole, they all come as blank. User's authentication type is also null. My understanding is that when I click Login button on Login control, system will automatically check for authentication. What am I doing wrong here? Thanks in advance for your help.

how to login in my portal using the user's username and password in active directory


i have a username and password in my portal... i want to connect to the active directory to verify the username and password of the user?

using c# .net

anyone can help me?

Using Active Directory Authentication when Windows Authentication fails


I have a web application (intranet based) which uses Windows Authentication.  Unfortunately there are public computers that have public logins at some company locations.  My web app doesn't support these public logins because I need to know the user working with the app.

So, even though these public users are windows authentication users, my app will fail because I have no user account setup for that particular account.  I want to then try Active Directory Authentication.

In my Default.aspx.cs I'd have something like this:

  protected void Page_Load(object sender, EventArgs e)
    userContext = new UserContext(); // If the authenticated user isn't a user in my system then throw an exception
   catch (UILayerException)
          // This I where I want to now do Active Directory Authentication
          // Maybe I redirect to a login page or what?
          // But remember the user IS authenticated even if they aren't a user in my system so I need to do something about that.

Forms authentication using Active Directory


I need some help troubleshooting authenticating via AD. All i get from my web application is "Your login attempt was not successful. Please try again." Allthough if i look at my PDC it shows NT AUTHORITY\ANONYMOUS LOGON in the event for my authentication request. I am using the Login.aspx auto generated.

Here is my web.config file:

<?xml version="1.0"?>
		<remove name="LocalSqlServer"/>
		<add name="GoliathConnectionString" connectionString="Data Source=RBBCM\MAPDB;Initial Catalog=Goliath;Integrated Security=True" providerName="System.Data.SqlClient"/>
		<add name="ThirteenConnectionString" connectionString="Data Source=RBBCM\MAPDB;Initial Catalog=Datamine;Integrated Security=True" providerName="System.Data.SqlClient"/>
		<add name="BugTrackerConnectionString" connectionString="Data Source=RBBCM\MAPDB;Initial Catalog=BugTracker;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="ADConnectionString" connectionString="LDAP://SSC1/CN=Users,dc=rbbcsc,dc=k12,dc=in,dc=us" />
    <customErrors mode="Off"/>
    <compilation debug="true"/>
    <authentication mode="Fo

How to modify the login control



I'd like to record more information than the default control allows as well as perform actions with the input when the form is submitted but I'm having trouble figuring out how.

So firstly, if I want to record the middlename for example, how would I do that, and by default, where would it go if anywhere?
When the form is submitted, I'd like to take specific input, such as just the middlename for example, and write some linq to sql code to specify when and how it's stored.
In what event would I put this code?


How to set SearchRoot Path in Active Directory in this scenario


How to set SearchRoot Path in Active Directory in this scenario:

Functionality: We have scenario that 1<sup>st</sup> hit one LDAP server with some 'fixed user name' &' fixed password ' and filter data with specific User name(which given by user) getting 'User dn'.

After that we hit Next LDAP server based on the 'User dn' getting from 1<sup>st</sup> server.

(So, in my case 1<sup>st</sup> LDAP server works like as Load balancing server but functionalitywise it is different)


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend