Solved

Windows Authentication using Application Pool

Posted on 2008-06-16
2
763 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

11 Experts available now in Live!

Get 1:1 Help Now