Solved

Windows Authentication using Application Pool

Posted on 2008-06-16
2
755 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
2 Comments
 
LVL 14

Accepted Solution

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

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

Author Closing Comment

by:justjuice
Comment Utility
It works - thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

8 Experts available now in Live!

Get 1:1 Help Now