Re: Cannot connect via Web Application...



Roger,

I appreciate you taking the time to help me out.
I tried what you said and am still failing with the same exception.

Imtiaz

Roger Wolter[MSFT] wrote:
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: User setup problem.
    ... login permissions for SQL Server. ... have access to SQL Server and the database through their ... windows group role membership which has the permissions.. ...
    (microsoft.public.sqlserver.security)
  • Re: Access Versus Windows NT Permissions
    ... full permissions to the folder in which the database is located is ... a large client of mine with many Access databases (using Windows ...
    (microsoft.public.access.security)
  • Re: Setting perm. on stored procedures using windows auth.
    ... windows account and are in the local windows administrators group, ... I support the Professional Association of SQL Server and it community ... I added that 1 user to a database role and I set execute ... > permissions for some stored procedures in my database. ...
    (microsoft.public.sqlserver.security)
  • Re: Access Versus Windows NT Permissions
    ... It'll be hidden in windows explorer, but savvy users can still get to it ... in the process which inherits the permissions of the folder. ... > permissions to the folder where the database is located for a user to even ... do newer versions of Access have a resolution? ...
    (microsoft.public.access.security)
  • Re: Shared Directories - Permissions
    ... "Roger" wrote in message ... > the shared drive) I do not have the same permissions. ... > Again its a W2K Server and a Windows XP desktop. ...
    (microsoft.public.win2000.security)

Loading