Re: Cannot connect via Web Application...



Log in as an admin. USE the database where your tables are and execute
these commands (substituting the name of you machine for servername)

CREATE LOGIN [servername\ASPNET] FROM WINDOWS
CREATE USER [servername\ASPNET] FROM LOGIN [servername\ASPNET]

http://msdn2.microsoft.com/en-us/library/ms189751.aspx
http://msdn2.microsoft.com/en-us/library/ms173463.aspx

You will then have to grant this user access to the objects it needs to
access for your application


--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"IV" <Imtiaz.Vohra@xxxxxxxxxxx> wrote in message
news:1168487427.667116.147270@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Roger,

Thanks for the reply.
I ran SQL Server Enterprise Manager and for that database, I checked
the Users.
there are two, dbo and guest, both having full permissions.
How would I confirm tthat I am running as ASPUSER and create a login
for it?

Thanks,
IV

Roger Wolter[MSFT] wrote:
I think your problem has something to do with permission as the error
indicates. If you are writing an ASP.Net web page then your web
application
is running as the ASPUSER Windows user and chances are this use does not
have permissions to connect to the database. When you run as a Windows
application you run as you and you probably have admin permissions on the
box which gives you SA permissions in the database so you can do whatever
you want. Confirm that you are running as ASPUSER and then create a
login
and user for it in SQL Server.

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"IV" <Imtiaz.Vohra@xxxxxxxxxxx> wrote in message
news:1168476873.734347.313800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am using SQLServer 2000, Visual Studio 2003, C#.

I am writing a web part which requires me to connect to a local sql
database.

I wrote a class which handles the connection and reading of the table.

When I try to call .Open on the connection, it fails, the exception is
something to do with permission.

I used the same class to connect with a console application and a
windows application, and it works fine. I am able to connect and read
the table.

Can anyone shed some light on what is the difference between
connecting/accessing to a database via Web Application as opposed to a
Non-Web App.

TIA




.



Relevant Pages

  • Re: Install MSDE w/ MSDE Depl.Toolkit. What permissions when using Win Auth?
    ... I created a login using Enterprise Manager on SQL Server on my server. ... Database Access tab I ticked the tick box for the database that I ... Now when my user installed the MSDE database on his machine locally, ...
    (microsoft.public.sqlserver.msde)
  • Re: SQL Server 2005 Express Remote connection
    ... I have also deleted the login for Fred from the list of users for my ... So Fred no longer exists as a login or as a user in the SQL Server setup. ... the database? ...
    (microsoft.public.sqlserver.server)
  • RE: copy permissions from one user to another?
    ... THIS STORED PROCEDURE GENERATES COMMANDS ... -- ADD USER TO SERVER ... -- CREATE TABLE TO HOLD LIST OF USERS IN CURRENT DATABASE ... -- SET COMMAND TO FIND USER PERMISSIONS HAS IN CURRENT DATABASE ...
    (microsoft.public.sqlserver.security)
  • Re: Moving a database to another server
    ... onto a server at home. ... The database has a user that has public, db_owner, ... SQL Server login or a Windows login. ...
    (microsoft.public.sqlserver.server)
  • Re: Installation OK, but cant connect
    ... > created an access database. ... SQL Server authentication is "client" independent.... ... connections or SQL Server authenticated connections... ... which authenticate user's login at the windows login step... ...
    (microsoft.public.sqlserver.msde)

Loading