Reputation: 13
I have a ASP.NEt page hosted in an IIS web server. This page just creates a connection string and open a connection. I want to pass client identity for the DB connection, as my DB stored procs are using current_user for verious tasks (typical client-server arch).
In development environment:when i run this page from visual studio on my dev machine everything works fine, DB connection is opened with my windows identity. And the value of current_user in stored procs is also myself. In the connection string i can see myself being authenticatred.
Problem: On deployement server, the above authentication happens for the server machine account and thus login for it fails. I somehow want the connection to be made using client credentials, so that the value of current_user in the SP's is always the user who has openbed the page.
Please help me with this and in case of any further questions, do let me know. Thanks in advance.
Upvotes: 0
Views: 353
Reputation: 416
Using impersonation on your web.config will resolve this issue.
Add the following line to your web.config file
<identity impersonate="true">
The link below explains the details of the impersonation and how it affects your web application http://msdn.microsoft.com/en-us/library/aa292118(v=vs.71).aspx
When you run the application in Visual Studio, it uses a web server that is other than IIS to run the web application. This web server would always use the logged in user's identity. When you deploy the application over to IIS, the application pool identity will be used for SQL Server access when impersonation is set to false. The default value for impersonation is false.
Upvotes: 1