Active Directory IIS needs to get user logged in from client not @ server

Charles Baldo
Charles Baldo used Ask the Experts™
on
Hi

I have an intranet site behind  a highly secure firewall.   I need to get the user at the client that is logged in

I am using this in c# in a web forms application

using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
...
....
....
  String UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

It gives me the account of the server.  I need to get the username of the person logged in at the client.

How can I do this?  Any way to make it pass through from to IIS?  Maybe turn anonymous access off?

Thank You
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chris DentPowerShell Developer
Top Expert 2010
Commented:
Turning off anonymous access would be a good first step. Perhaps consider using Windows Integrated Authentication for your application.

Then you can use this to retrieve the user:
WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity

Open in new window

Chris
Senior Developer
Commented:
You need to activate impersonation:

- Using IIS Authentication with ASP.NET Impersonation
- Configure ASP.NET Impersonation Authentication (IIS 7)

Important: do this in collaboration with your domain and network administrator.
Charles BaldoSoftware Developer

Author

Commented:
Thank you both were neeeded

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial