Re: ADO SQLConnection works only in Windows, but not in WEB

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins

"Dan Aldean" <doruroman@xxxxxxxxxx> wrote in message
news:OdYlH1N7GHA.200@xxxxxxxxxxxxxxxxxxxxxxx
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




.



Relevant Pages

  • Re: No db access after publishing web site
    ... GRANT UPDATE TO ... If I detach and attach this database on a different PC (according that PC ... Cannot open database "pago" requested by the login. ... Are you detaching/attaching the SQL Server Express database correctly ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Newbie to security
    ... Use sp_grantdbaccess to grant access to the database. ... databases when you are new to security. ... Microsoft SQL Server 2000 SP3 Security Features and Best ...
    (microsoft.public.sqlserver.security)
  • Re: Install MSDE w/ MSDE Depl.Toolkit. What permissions when using Win Auth?
    ... > have my SQL database sitting on my server. ... > the local MSDE database. ... on your SQL Server you grant login to that group and grant db access too... ...
    (microsoft.public.sqlserver.msde)
  • Re: SQL Server Express
    ... GRANT them permissions to do so with the GRANT command. ... GRANT CREATE DATABASE on DATABASE::xxx to SAM ... Yes, I am very familiar with configuring specific SQL Server accounts for access, and I am having no real problems in this area. ... really a good way to block administrator access without making your database pretty hard to administer. ...
    (microsoft.public.sqlserver.msde)
  • Re: How to Generate all grants to a user role? (SQL Server 2000)
    ... another version of the database. ... WHEN 204 THEN 'GRANT' ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)