Solved

Windows Authentication using Application Pool

Posted on 2008-06-16
2
766 Views
Last Modified: 2012-06-27
Hi

I'm not sure if this is an ASP.NET question or an IIS one, so I'll give it a go here first.

I have an application running on two servers. Server A hosts IIS and the ASP.NET application and Server B hosts the SQL Server database the application uses. We have to use Windows Authentication to access the SQL Server db so a service account has been created and the details entered into an Application Pool that has been created for the application on IIS.

This all works fine. The problem is that we need to capture the Windows Username of the browser user, but the following code returns the service account user setup in the Application Pool:-
WindowsIdentity.GetCurrent().Name

Is it possible to configure the setup so that the SQL Server is accessed with the service account but the actual user accessing the application via the browser also has their windows username accessible?

Thanks in advance.
0
Comment
Question by:justjuice
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
ajitha75 earned 500 total points
ID: 21793586
Instead of WindowsIdentity.GetCurrent().Name use

System.Threading.Thread.CurrentPrincipal.Identity.Name
0
 
LVL 1

Author Closing Comment

by:justjuice
ID: 31467570
It works - thank you.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

717 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