1
votes

I have developed an ASP.Net website. The problem I am facing is when I run the application in IIS on my system using the connection string in web.config ("Data Source=.\;Initial Catalog=ITS;Integrated Security=True") it works well. I connects to the database and displays the data.

I have installed the database on a domain computer with the ASP.NET package in IIS. The problem here is it doesn't connects to the database. I have tried to use the connection string like this "Data Source=.\;Initial Catalog=ITS;UID=S1\ISLWW74562S;PWD=delta$%67;Integrated Security=True"

Where S1 is the domain name and ISLWW74562S is the username.

It gives an error cannot find the login S1\ISLWW74562S$

Can anyone help me how and what is the proper way to use the connection string on a domain computer.

Thanks

2

2 Answers

2
votes

Remove the UID=S1\ISLWW74562S;PWD=delta$%67 from the connection string, and instead in IIS, create a special application pool for your web site and configure such application pool to run under the domain account.

Take a look at this to see how to setup the application pool to use a custom account.

Also, make sure that the domain account that you are using has the required access to the SQL database that you want to use.

If you are using Microsoft SQL server, then you need to use SQL management studio to create a new login for the domain user and give it the appropriate access to the database that you are using.

2
votes

When you use Integrated Security, you don't get to specify the username and password. Sql Server will not allow you to do this. Instead, it's looking for a token that was issued by the domain controller, and that's all it will accept.

You can get a token like this for your application by using the Impersonation feature in IIS or by setting up the application pool for IIS to run as that user account.