Greetings. I am curently having problems with authorizations while attempting to connect to SQL Server with an Asp.NET web application. I will try to explain my problem as clearly as possible.

I am developing an Asp.NET web application with Visual Studio to connect and view a database on a remote SQL Server. In my Web.config file, I have added the line
<identity impersonate = "true"/>

In my IIS security options, I have disabled the annonymous authentication and enabled the Windows mode authentication instead. When accessing the database from my computer, by compiling and debugging my web application in Visual Studio, everything works wonder. When I try to use the web application from a remote computer using the IP address or from my own computer using localhost in the URL, it asks me for my Windows username and password, which I provide, and then refuses any further access, saying I don't have permission to even connect to the server.

How can I go around this and allow my users to connect to the server from a remote computer My machine is running Windows XP SP2 and the server is running Windows Server 2003.

Thank you in advance for any help you may provide,


Re: Accessing SQL Server from Asp.NET


I think you have to add the followings in web.config:

<authentication mode="Windows"/>

<add name="YourNameconnection" connectionString="Data Source=YourDBServerName;Initial Catalog=YourDB;Integrated Security=True" providerName="System.Data.SqlClient"/>

This if YourDBServerName server and YourWEBServer are in a domain and the YourWEBServer web server has a domaint account , let's say YourDomain\webaccnt, and it have a SQL login named YourDomain\webaccnt that can use YourDB db as db default on the YourDBServerName server name.

Re: Accessing SQL Server from Asp.NET


Thank you very much. I was surprised my problem was such a simple piece of code that was missing. It works wonders now. Thank you for your help and concern Smile