Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,
I have read about window authetication in asp.net, basically it works with IIS level of Authentication.
When users request is send to the IIS, they are prompted for username and password.

I have quries about it
Where do we set username and password?<br />


Any other points is most welcome and thankful :)

Thanks in advance
Posted
Updated 7-Feb-12 19:22pm
v3

Here Is Good Explanation Of Windows Authentication In Code Project.
Have A Look

1. Windows Authentication[^]

Also Refer

1. http://www.asp.net/mvc/tutorials/older-versions/security/authenticating-users-with-windows-authentication-vb[^]

2. http://msdn.microsoft.com/en-us/library/ff647405.aspx[^]

Hope This Articles Will Clear Your Views
 
Share this answer
 
Using WindowsPrincipal and WindowsIdentity class provided by .NET System framework, you can validate the username as below:

C#
using System.Security.Principal;
using System.DirectoryServices;

        private Boolean AuthenticateWindowsID(String username)
        {
            WindowsIdentity ident = WindowsIdentity.GetCurrent();
            WindowsPrincipal user = new WindowsPrincipal(ident);

            using (DirectoryEntry de = new DirectoryEntry("LDAP://" + StripDomain(user.Identity.Name)))
            {
                using (DirectorySearcher adSearch = new DirectorySearcher(de))
                {
                    adSearch.Filter = "(FirmAccountName=" + username + ")";
                    SearchResult adSearchResult = adSearch.FindOne();
                    if (adSearchResult != null)
                        return true;
                }
            }
            return false;
        }
 
Share this answer
 
Comments
dhage.prashant01 8-Feb-12 1:03am    
i want to know do I need to create account for every user and set its username and password?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900