DirectoryEntry dEntry = new DirectoryEntry(WinNT:// + Environment.UserDomainName
return dEntry.Properties["fullNam
Main Topics
Browse All TopicsI have developed an ASP.NET 3.5 web application which is hosted on Windows 2003 Server using IIS 6. In my application, I need to get the user name of the person accessing the site. In IIS, I have the site configured so that it does not use Anonymous access and the Windows Integrated checkbox is checked. So when the user enters the site, they enter their credentials. great. But I cannot seem to extract the user name. I have read many posts and tried many methods, but can't seem to get it. Take a look at the screenshot to see all the different methods I tried.
Label1.Text = Request.ServerVariables("A
Label2.Text = System.Web.HttpContext.Cur
Label3.Text = HttpContext.Current.User.I
Label4.Text = Request.ServerVariables("L
Label5.Text = System.Security.Principal.
Label6.Text = Request.Form("userName")
they all result in empty strings. Any ideas? Please note that this site is configured with a certificate (https). In my web.config, I have impersonate="true" in the identity tag. I also have Authentication mode="Windows". All ideas welcome! Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: dhansmaniPosted on 2009-11-05 at 21:55:29ID: 25756882
try this
g();
========== ========== ========== ========== =========
ttgu/archi ve/2006/07 /12/ Recipe _3A00_-Ena bling-Wind ows-Authen tication-w ithin-an- I ntranet-AS P.NET-Web- applicatio n.aspx
add reference
using System.Web.Security;
string username = User.Identity.Name.ToStrin
read about Enabling Windows Authentication within an Intranet ASP.NET Web application
==========================
http://weblogs.asp.net/sco