ADO SQLConnection works only in Windows, but not in WEB

D

Dan Aldean

Hi,

I use the same connection string in a Windows and then in a WEB application
to connect to SQL Server.

When I try it in the WEB it doesn't work,

private SqlConnection conTest = new SqlConnection(@"data
source=YOUR-136A4423DC\localhost;initial catalog=TestDB;integrated
security=SSPI;persist security info=False;workstation
id=YOUR-136A4423DC;packet size=4096");

conTest.Open();

the error on open is:

Login failed for user 'YOUR-136F2019DC\ASPNET'.


what is different and raises the error?

Thanks
 
C

Chris Mullins

The ASP.Net application is running as user "'YOUR-136F2019DC\ASPNET'

When you run the code in a web app, it's running as,
"YOUR-136F2019DC\doruroman".

Guess which of these uses has access to the SQL Server database?

Your options are:
1 - Grant your ASPNET user access to the database
2 - Run ASP.Net as a different user. Grant that user access to the database.
3 - Use SQL Authentication rather than Integreated Security.
(user=sqluser;password=nopassword)

Much more info can be found at:
http://msdn2.microsoft.com/en-us/library/ht43wsex.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top