[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

ASP.Net / SQL Permissions Integrated Windows Authentication Dilema

Asked by IMacNeill in Programming for ASP.NET

Tags: windows, authentication, identity

Here is my question: Is there a way to have ASP.Net pass through the previously authenticated Windows user credentials to SQL server without providing hard-coded user information either in the web.config or in the ASP.Net code itself?

Here is my scenario:

Building a suite of Intranet tools for my company. The web server is a Windows 2003 Server in an Active Directory domain, where the SQL Server 2000 system is on a seperate machine. Both the web server and the SQL server are within the same Active Directory domain.

Each Intranet tool is seperate web page, which is part of a single ASP.Net solution. We need to provide explicit permissions for each tool and we have SQL groups assigned to provide specific permissions at the SQL level as well. So that User A using Tool B only has SELECT permissions for Table C, but User B using Tool D has SELECT, INSERT and UPDATE permissions for TableC.

We have IIS on the web server setup for Windows Integrated Authentication, with no anonymous users allowed. My thought was that ASP.Net would use the authenticated user credentials (from when the user had to provide them at the first page hit) and pass them through to the SQL server when any calls were made -- it would appear that this is not the case however.

The SQL server is setup as Mixed Mode, and my SQL connection string is setup as follows:
Data Source=[MY SQL SERVER];Initial Catalog=[MY SQL DATABASE];Trusted_Connection=yes

In the web.config, I have the <authentication mode="Windows"> tag set, as well as <authorization> set to <allows users="*" />.

When the application page is first hit with a new browser, I am presented with a Windows logon dialog. Upon succsfully entering my credentials, the form page is displayed.

I have included display of the following variables in the Page_Load() method to better understand what is happening:
- HttpContext.Current.User.Identity.Name
- WindowsIdentity.GetCurrent().Name
- Thread.CurrentPrincipal.Identity.Name

Upon entering a value into my textbox and hitting the submit button - the SQL call is made. This is when I receive the SQL errors.

When I have <identity impersonate="false"> in the web.config, I get the following results:
- [SQL ERROR]: Login failed for user 'MY_DOMAIN\MY_MACHINE_NAME$'.
- HttpContext.Current.User.Identity.Name = [MY DOMAIN\MY LOGON USER]
- WindowsIdentity.GetCurrent().Name = [NT AUTHORITY\NETWORK SERVICE]
- Thread.CurrentPrincipal.Identity.Name = [MY DOMAIN\MY LOGON USER]

When I have <identity impersonate="true"> set in the web.config, I get these results instead:
- [SQL ERROR]: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
- HttpContext.Current.User.Identity.Name = [MY DOMAIN\MY LOGON USER]
- WindowsIdentity.GetCurrent().Name = [MY DOMAIN\MY LOGON USER]
- Thread.CurrentPrincipal.Identity.Name = [MY DOMAIN\MY LOGON USER]

All I want is to be able to have the system "Pass Through" the already authenticated logged in domain user credentials to the SQL server as the permissions to be used for validating the SQL code. Can anyone point me to the correct information on how this can be done in a multiple server environment?

So far every solution I have encountered talks about providing a single account to be used for SQL operations (whether it be the IIS_WPG or a custom designed domain account), and either describes setting up delegation for seperate server setups -- or hard coding user credentials in config or code files. All I want to do is to use the already supplied user credentials for ALL security permission checks. Can this be done? Or will we have to rethink how the security for our Intranet is to be setup?

Thanks in advance for your replies and taking the time to read this.
 
Related Solutions
Keywords: ASP.Net / SQL Permissions Integrat…
 
Loading Advertisement...
 
[+][-]04/05/06 01:49 PM, ID: 16386323Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/05/06 02:15 PM, ID: 16386542Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Programming for ASP.NET
Tags: windows, authentication, identity
Sign Up Now!
Solution Provided By: Torrwin
Participating Experts: 2
Solution Grade: B
 
[+][-]04/05/06 02:17 PM, ID: 16386559Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04/06/06 07:50 AM, ID: 16392233Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/06/06 08:17 AM, ID: 16392587Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/17/06 07:57 AM, ID: 16469509Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy