Can't Impersonate User Info thru ADO.Net
-
Ok, so anyone ready for a good one??? Trying to run a vb.net webApp that connects to sql. I can NOT allow the domain username to be written in the web.config file so I must use impersonation (trusted_connection). Problem:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
when trying to access remote SQL Server with
<identity impersonation = "true" />
-- I need to beable to connect/access the sql db by use of domain user accounts, but without having to manually enter the user credentials to access. IOW by use of Impersonation. Configuration: I've tried to configure IIS to both of these two possible options: A.) Anonymous Access is DISABLED and Integrated Windows Authentication is ENABLED B.) Anonymous Access is ENABLED and Integrated Windows Authentication is DISABLED with username defined as a valid domain account/password.(i'll explain this method later) I have defined my SQLConnectionString as:
Data Source=ServerName01;Initial Catalog=StageDBid;Integrated Security=SSPI;
I have also setup a block of code that would check the current impersonated user before executing the sqlConnection and am getting the [correct]expected User.Identity back. So I know that the Impersonation aspect is functioning, but for some reason it is not passing this info to the DB or the "Integrated Security=SSPI"("Trusted_Connection="yes" ") is not working. Requested Soultion: I need to beable to connect to SQL thru the webApp by use of the individual Users Domain Account UserNames.) Oh, yah I promised to explain my second method of connection to the db by use of the Anonymous Account.... I Can connect to the db if I use the method (B) listed above, with impersonation enabled and using a domain user account by disabling Integrated Windows Authentication and specifing the domain account.... problem is I'm still restricted to using a single account for connection to the db. I need to beable to connect/access the sql db by use of domain user accounts, but without having to manually enter the user credentials to access. IOW by use of Impersonation. string Beautiful; Beautiful = "ignorant"; label1.Text = "The world is full of " + Beautiful + " people."; Why is common sense such an un-common comodity?
-
Ok, so anyone ready for a good one??? Trying to run a vb.net webApp that connects to sql. I can NOT allow the domain username to be written in the web.config file so I must use impersonation (trusted_connection). Problem:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
when trying to access remote SQL Server with
<identity impersonation = "true" />
-- I need to beable to connect/access the sql db by use of domain user accounts, but without having to manually enter the user credentials to access. IOW by use of Impersonation. Configuration: I've tried to configure IIS to both of these two possible options: A.) Anonymous Access is DISABLED and Integrated Windows Authentication is ENABLED B.) Anonymous Access is ENABLED and Integrated Windows Authentication is DISABLED with username defined as a valid domain account/password.(i'll explain this method later) I have defined my SQLConnectionString as:
Data Source=ServerName01;Initial Catalog=StageDBid;Integrated Security=SSPI;
I have also setup a block of code that would check the current impersonated user before executing the sqlConnection and am getting the [correct]expected User.Identity back. So I know that the Impersonation aspect is functioning, but for some reason it is not passing this info to the DB or the "Integrated Security=SSPI"("Trusted_Connection="yes" ") is not working. Requested Soultion: I need to beable to connect to SQL thru the webApp by use of the individual Users Domain Account UserNames.) Oh, yah I promised to explain my second method of connection to the db by use of the Anonymous Account.... I Can connect to the db if I use the method (B) listed above, with impersonation enabled and using a domain user account by disabling Integrated Windows Authentication and specifing the domain account.... problem is I'm still restricted to using a single account for connection to the db. I need to beable to connect/access the sql db by use of domain user accounts, but without having to manually enter the user credentials to access. IOW by use of Impersonation. string Beautiful; Beautiful = "ignorant"; label1.Text = "The world is full of " + Beautiful + " people."; Why is common sense such an un-common comodity?
For your option A, did you have digest authentication checked? I've used the exact same thing you're talking about with no problems getting to the database, but I had digest authentication on.