MSSQL login fails but Test Connection Succeeds

  • Thread starter Thread starter John Spiegel
  • Start date Start date
J

John Spiegel

Hi all,

I've been working through a simple example using the SQL Server Northwind
database installed on my development machine. The example uses the Data
Form Wizard and when I set up the connection there it tests fine. When I
try to run the page it gives "Login failed for user 'ASPNET'". I've tried
both NT-integrated security and added an "ASPNET" user to SQL Server.
Still same issue--test works, running doesn't. Any pointers where to look?

TIA,

John
 
Something to test is to be sure you know who the user is at the time ASP.NET
is looking to make the connection.

You can determine this with code like:

Dim wi As System.Security.Principal.WindowsIdentity = _
WindowsIdentity.GetCurrent
lblAuthenticatedUser.Text = wi.Name
 
Thanks, Ken!

It is indeed running under the ASPNET account. I managed to get it working
by changing the connection string that the wizard had produced. Although,
it was admittedly more of a copy and paste from something else that had
worked than my deep understanding of the options for connection strings.

Is there a setting (global.asax? machine.config?) where I could either set
the account it runs under or some related way of getting more control?

Thanks, again,

John
 
Back
Top