Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ASP application cannot find SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-26 : 08:16:24
Lawrence writes "I "live" in a Windows 2000 Server environment. I have a trial version of SQL Server loaded on my XP Pro workstation. I have workstation administration priviledges with sysAdm auth in SQL Server. I have built the needed database and tables and loaded the tables with initial data. Query Analyzer works fine.

I also have a workstation based intranet installed using IIS. I am attempting to use a canned ASP application on my intranet to access SQL Server. The application works elsewhere (via the internet). When I attempt to use the application, the initial page displays fine but then I receive the following error:

Microsoft OLE DB Provider for SQL Server (0x80004005)
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
/default.asp, line 40

The applicable ASP code is as follows:
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
strUserName = trim(request("txtUserName"))
strPassword = trim(request("txtPassword"))

set rsData = Server.CreateObject("ADODB.Recordset")
set conn = server.CreateObject("ADODB.connection")

strUserName = replace(strUserName,"'","")
strPassword = replace(strPassword,"'","")

strSQL = "SELECT * from person " +_
"where user_name = '" + strUserName + _
"' and password = '" + strPassword + "'"

conn.ConnectionString = Application("DBConn_ConnectionString")
conn.open

I set up SQL Server to use Windows Authentication. I get the same results logging on locally or through the LAN.

I've tried the books online but I cannot find the answer or the right magically search words. Where should I look?

Note: I have never used a forum and I'm not sure where to look for your answer. An email would be helpful. Thanks."

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-05-26 : 12:44:02
It sounds like your web site is setup to allow anonymous access, which means that the web pages are trying to access the SQL Server under the IUSR_machinename identity and not under your own. You basically have 3 options:

1) Grant IUSR_machinename access to SQL Server. This is the least secure.
2) Modify IIS settings to use a different identity for the anonymous login and grant that identity access to SQL Server.
3) Disallown anonymous access to the web site (or virtualy directory) and authenticate as yourself to IIS, which will then pass you through to SQL Server. This is probably your best option.

---------------------------
EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -