Solved

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

Posted on 2016-09-29
3
69 Views
Last Modified: 2016-09-30
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
0
Comment
Question by:charlesbaldo
3 Comments
 
LVL 70

Assisted Solution

by:Chris Dent
Chris Dent earned 250 total points
ID: 41823097
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
0
 
LVL 33

Accepted Solution

by:
ste5an earned 250 total points
ID: 41823193
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.
0
 

Author Closing Comment

by:charlesbaldo
ID: 41823347
Thank you both were neeeded
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now