Plaese help a newbie with data access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Okay, I'm new to .NET development. I need to build a simple tool web based to
display a data set from a SQL2000 database.

When I create the connection and test it, it works fine. I build the page,
test it and get denied access to the database (ASP error) because user is
'NULL'.

The IIS and SQL are on the same server. We also run Sharepoint and that
recognises the user from the wondows logon. The web application should take
the user information from the Windows logon and authenticate on the SQL using
that. The issue does not appear to be caused by the user not having rights
but that the user information is not sent though.

I've had a search around and someone mentioned firewall but that doesn't
apply in this case.

Thanks all!!!
 
I assume that the IIS is set up to use Windows Authentication (with anonymous
access disabled) for your web application.

In order to allow asp.net to use the Windows credentials when connecting to
your (local) SQL Server, you need to enable delegation by adding the
following line to the web.config file (in the system.web section):

<identity impersonate="true"/>

This will not suffice if the web server and SQL Server are on different
machines since you will then run into all kinds of delegation issues, but for
your case it should work.

HTH, Jakob.
 
Jakob,

thanks for the help but it seems to change nothing. I have tried adding the
line just after authentication method = Windows. now the strange thing is
that if I try again but with a set username and password in the data
connection, I get the same thing!
 
Back
Top