Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 12, 2012 01:39 AM by Steven Cheng - MSFT
Apr 10, 2012 06:44 AM|LINK
Hi there,I want to implement a web site which will log in via Windows Authenticate.
We have around 200 employees in our co and I dont want to log in via Forms authentication.
so no need to log in by Username and password,I want when each user wants to open a page his/her system name presents.
Apr 10, 2012 07:57 AM|LINK
If you're using Windows authentication you can get the username of the logged in user like this:
You can set a label with a welcome message in the Page_Load event of a page:
protected void Page_Load(object sender, EventArgs e)
Label1.text = "Welcome " + WindowsIdentity.GetCurrent().Name;
Apr 10, 2012 08:52 AM|LINK
thanks for your responding,another problem is that:
we use Active Directory,and when I do this,it returns:
I also cheked this code:
but it return something like this:
Apr 10, 2012 09:13 AM|LINK
You can try HttpContext.Current.User.Identity.Name.
Apr 10, 2012 09:33 AM|LINK
As I found out I should use "Using a Domain Users Account".
But I don't know how to do this.
Apr 12, 2012 01:39 AM|LINK
When using windows authentication, that meanns you rely on the windows operating system and IIS server to help you perform authentication through the windows identity used by the client user(of your web application).
In order to use windows authentication, you need to make sure your web application's hosting and client user's machine meet the requirements. Generally, both the client and server machines should be in the same local network environment, and they should
be part of the same Windows domain (or trusted domain). There should exists a Domain Controller(DC) server in your environment which manage all the domain user accounts and the machines joined that domain can use the domain accounts(instead of the local user
accounts on each computer) for authentication when logon to remote machines. So make sure your current environment is ready on this. For detailed information about windows AD and domain, you can try posting in the technet "Windows Server" related forums:
and for using integrated windows authentication in ASP.NET, here are some good reference for you to understand how it works:
#Explained: Windows Authentication in ASP.NET 2.0
#How to implement Windows authentication and authorization in ASP.NET