Link to home
Start Free TrialLog in
Avatar of daforga
daforga

asked on

Login failed for user 'Servername\ASPNET'.

I am trying to connect to my SQL 2005 Server through an aspx page using window authentication. I get the error message.  My connection string is:       
conNorthwind = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;Database=Northwind" );
My server is named SaintAndrews.  I get the following error  Login failed for user 'SaintAndrews\ASPNET'.

Can anyone help me out with this?
Thanks
Avatar of TornadoV
TornadoV
Flag of United States of America image

It sounds like you are using a trusted security context in your Sql connection string. Try removing the trusted connection goop from the string and adding a valid Sql Server username and Password. Alternately you can give the ASPNET account access to the database in Sql Enterprise
Manager.
ASKER CERTIFIED SOLUTION
Avatar of MikeMCSD
MikeMCSD
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nehaya
nehaya

Go to your Sql Server,  create new user account with the name : ASPNET and give it permission on your desired tables.

Have fun!
Regards,
Nehaya
Avatar of daforga

ASKER

actually it is in SQL 2005, so I need3ed to say "user id"  but,  Thanks Mike MCSD.  It worked.   Yay!