Security context issue (weird behavior)



Hi, I have a problem I have not been able to solve and after reading a lot on
msdn an on the web I'm not sure what might be causing it.
I have IIS 5.1 running on windows XP SP2 (I'll use windows 2003 server once
I figure out how to make it work) and SQL Server 2000 running on Windows 2003
server. Both machines are on the same domain.
The SQL Server is setup to use mix mode authentication.
I have a virtual directory setup on IIS, and uncheck everything on the
security tab except the Integrated Windows authentication Option, since I
want to use a group to grant access to the virtual directory to certain
users. Also, I need to use Integrated Windows authentication since I need to
determine the user account that is accesing the virtual directory.
The users have a domain account. The pages are developed on asp (not asp.net).
I'm using a SQL account to log in to the SQL Server. The SQL server, as I
mentioned before, is setup to mixed mode.
If I see the pages on the same machine where I have installed the IIS
everything works fine. The page displays my user id and I'm able to log in to
the Sql Server with the SQL account.
To log in to the SQL server I use an ADO connection. The ADO connection
string I'm using is this one:

"Provider=SQLOLEDB.1;" & _
"Trusted_Connection=false;" & _
"Data Source=SQLServer;" & _
"Initial Catalog=DB;" & _
"User ID=User;" & _
"Password=Password;"

If I try to view the pages on another computer on the network I'm able to
access the pages, but the asp page throws an error on the line that opens the
connection. The error I get on the web page is that the user User could not
log in, because there is no trusted connection. I've used the same user
logged in the machine on both scenarios. I have also tried with other users
and got the same error.

I have an idea of what could be the problem. I think the connection to the
SQL Server is being made on the security context of the account running the
IIS service, which is the System Account. I think this, because I've disabled
anonymous access and the IIS server can't delegate the information from the
user. Since it's running on the security context of the System account, it
can't be validated by the SQL Server, eventhough I'm using a SQL account on
the connection string.

I tried to view the pages from another machine with the anonymous access
enabled (IUSR_MachineName), but got the same result. I've also tried to run
the virtual directory using anonymous access with my domain account, but got
the same result.

After the unsuccesful tryies I decided to create a local account on both
machines, with the same username and password. Set up the anonymous access on
the virtual directory, using that local account, and finally was able to log
in to the SQL Server with the SQL account. But, on this scenario I cannot
determine the user Id of the person viewing the page.

I tried using ODBC and DSN in the connection string but got the same result:
could not stablish the connection because there is no trusted connection.

I have no access to the Active Directory console.

For what I've read I thought that by using a SQL server account on the
connection string I would be able to connect, since SQL server would be in
charge of the authorization between IIS and SQL. And IIS would take care of
the authorization between the client machine viewing the pages and the
virtual directory, but I think I was wrong.

Any help would be very appreciated, since I can't find a way out.
Thanks in advance.

.



Relevant Pages

  • Re: SQL Connection String using Domain Account
    ... Web.Config but now have the problem that the web site will not run under ... you can have a username/password set up in sql server - but this would ... The DBA has given me a Domain user account with rights to ... I am unable to get a connection to the database. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Passthrough authenication w/ SQL trusted connection
    ... separate connection will be used for each security context (each user ... account will have it's own pool). ... if you are using a Windows 2000 Domain, ... backend SQL Server. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Permissions!
    ... This account is used because your web ... application is configured for anonymous access instead of integrated ... The details on how to use Windows ... SQL Server MVP ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Server on XP Home Network
    ... There is an "sa" account under the Security>Logins area. ... Does that coorelate to a SQL Server login? ... I tried setting up the connection to use that SQL Server ...
    (microsoft.public.sqlserver.setup)
  • Re: Login failed for user (null)
    ... SSPI security assumes that the user credentials are known to the SQL Server. ... Setup a login account matching your credentials and give the account rights ... > When I created my connection in the Data Adapter Configuration wizard, ...
    (microsoft.public.dotnet.framework.adonet)