I believe the connection string isn't working from ASP because the security
context is different. When you try it from VB, you're logged in as
yourself. I assume your NT account has access to the SQL Server. When you
try it from IIS, your code is running in the security context of
IUSR_MACHINENAME, assuming you are using anonymous access. If you're using
NT Challenge/Response, the page will run under the security context of the
NT user you log in as.
The solution is to either:
1) not use a trusted connection with SQL Server. The is configurable by SQL
Server and would mean you'd pass a username / password to make the
2) Log in as a user that has access to the database.
3) Make an account that has access to the database, and change IIS so it
uses that account as its anonymous user. You can change the settings for
the web in IIS 4 under the security tab (if I remember correctly). Be
careful with the permissions you give this account. Anyone will access to
your pages with effectively have the same permissions on your network as the
new anonymous account you create.
Anyone else? Are there other options?
Hope this helps,
The reason your connection string isn't working from ASP
>I have written some ASP vbscript in Interdev to connect to an SQL Server on
> Set rst = Server.CreateObject("ADODB.Recordset")
> Set con = Server.CreateObject("ADODB.Connection")
> con.Open "...blah..."
> Set rst = con.Execute("authors", , 2)
>...just to get a recordset to html.
>THE PROBLEM: The connection string I am using does not login to the SQL
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed- User: _ Reason: Not defined as a valid user of a trusted
>SQL Server connection.
> /TestDbASP/default.asp, line 18
>BUT: The EXACT same connection string works from VB6.0
>Seb Reeve - Sabio Limited