Solved

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

Posted on 2016-09-29
3
78 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

816 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

10 Experts available now in Live!

Get 1:1 Help Now