Re: SqlConnection.Open() permission denied for remote sql server

Discussion in 'ASP .Net' started by Kevin Spencer, Aug 15, 2003.

  1. Is the SQL Server using Windows Authentication or SQL Server authentication?
    What does your Connection String look like? And what is the exact
    "permission denied message?"

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Elin Asphjell" <> wrote in message
    news:...
    > Hi
    >
    > I'm developing a web application in dotnet/csharp that connects to a sql
    > server using the SqlConnection object. The problem is that I cant open a
    > connection to the database when it is located on a different computer than
    > the webserver. I get a permission denied message. When I move the connect
    > code into a consol application , I can open the connection. So I guess the
    > asp.net user has too few permissions? Can someone help me? The web
    > application has security set to anonymous access and the intecrated

    security
    > checkbox is checked.
    >
    > Regards
    > Elin Kolloen
    >
    >
     
    Kevin Spencer, Aug 15, 2003
    #1
    1. Advertising

  2. The SQL server has both windows authentication and sql server authentication
    enabled. I'm sending the sql server login id and password in the
    connectionstring. The connectionstring looks like this:
    "Data Source=SERVERNAME;Inital Catalog=DATABASENAME;User
    ID=LOGINNAME;Password=PASSWORD". The error message is:
    "System.Data.SqlClient.SqlException: SQL Server does not exist or access
    denied." Since I know the server exists and I can connect with my consol
    app, I'm guessing it's a permissions problem.

    Regards
    Elin Kolloen

    "Kevin Spencer" <> wrote in message
    news:...
    > Is the SQL Server using Windows Authentication or SQL Server

    authentication?
    > What does your Connection String look like? And what is the exact
    > "permission denied message?"
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > http://www.takempis.com
    > Neither a follower nor a lender be.
    >
    > "Elin Asphjell" <> wrote in message
    > news:...
    > > Hi
    > >
    > > I'm developing a web application in dotnet/csharp that connects to a sql
    > > server using the SqlConnection object. The problem is that I cant open a
    > > connection to the database when it is located on a different computer

    than
    > > the webserver. I get a permission denied message. When I move the

    connect
    > > code into a consol application , I can open the connection. So I guess

    the
    > > asp.net user has too few permissions? Can someone help me? The web
    > > application has security set to anonymous access and the intecrated

    > security
    > > checkbox is checked.
    > >
    > > Regards
    > > Elin Kolloen
    > >
    > >

    >
    >
     
    Elin Asphjell, Aug 15, 2003
    #2
    1. Advertising

  3. That was a helpful tip, thank you. I have now used the profiler and found
    that there is no attempt to login when I run my web application. My consol
    application leads to a succesfully login. Since I run these two application
    from the same computer, it is not just a network problem. The only
    difference is that the web application runs as the anonymous user/asp.net
    user, and the consol application runs as the logged on domain user (my
    account). So I'm back to permissions again, and hope someone can help me.

    Regards
    Elin Kolloen


    "Kevin Spencer" <> wrote in message
    news:...
    > The error message indicates that one of two possible things happened:
    >
    > 1. The Login Failed
    > 2. A Network issue prevented the request from reaching the SQL Server.
    >
    > It is a relatively simple matter to find out if the login failed (which
    > isn't likely in your case, because it can connect to the same machine's

    SQL
    > Server, which I presume is set up the same?). In any case, you can set up
    > SQL Profiler on the target machine to audit logins. If you do this, and

    run
    > your app, you will see whether or not the login was attempted. If not,

    it's
    > a network issue.
    >
    > If it is a network issue, it could one of several possibilities. Your best
    > bet in that case would be to talk with your Network Admin about the

    problem.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > http://www.takempis.com
    > Neither a follower nor a lender be.
    >
    > "Elin Asphjell" <> wrote in message
    > news:...
    > > The SQL server has both windows authentication and sql server

    > authentication
    > > enabled. I'm sending the sql server login id and password in the
    > > connectionstring. The connectionstring looks like this:
    > > "Data Source=SERVERNAME;Inital Catalog=DATABASENAME;User
    > > ID=LOGINNAME;Password=PASSWORD". The error message is:
    > > "System.Data.SqlClient.SqlException: SQL Server does not exist or access
    > > denied." Since I know the server exists and I can connect with my consol
    > > app, I'm guessing it's a permissions problem.
    > >
    > > Regards
    > > Elin Kolloen
    > >
    > > "Kevin Spencer" <> wrote in message
    > > news:...
    > > > Is the SQL Server using Windows Authentication or SQL Server

    > > authentication?
    > > > What does your Connection String look like? And what is the exact
    > > > "permission denied message?"
    > > >
    > > > --
    > > > HTH,
    > > >
    > > > Kevin Spencer
    > > > Microsoft MVP
    > > > .Net Developer
    > > > http://www.takempis.com
    > > > Neither a follower nor a lender be.
    > > >
    > > > "Elin Asphjell" <> wrote in message
    > > > news:...
    > > > > Hi
    > > > >
    > > > > I'm developing a web application in dotnet/csharp that connects to a

    > sql
    > > > > server using the SqlConnection object. The problem is that I cant

    open
    > a
    > > > > connection to the database when it is located on a different

    computer
    > > than
    > > > > the webserver. I get a permission denied message. When I move the

    > > connect
    > > > > code into a consol application , I can open the connection. So I

    guess
    > > the
    > > > > asp.net user has too few permissions? Can someone help me? The web
    > > > > application has security set to anonymous access and the intecrated
    > > > security
    > > > > checkbox is checked.
    > > > >
    > > > > Regards
    > > > > Elin Kolloen
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Elin Asphjell, Aug 15, 2003
    #3
  4. If it's not reaching the SQL Server, it's a Network issue. Could be Network
    permissions, but the Network is what is blocking the call. Again, I
    recommend you talk with your Network Admin.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Elin Asphjell" <> wrote in message
    news:...
    > That was a helpful tip, thank you. I have now used the profiler and found
    > that there is no attempt to login when I run my web application. My consol
    > application leads to a succesfully login. Since I run these two

    application
    > from the same computer, it is not just a network problem. The only
    > difference is that the web application runs as the anonymous user/asp.net
    > user, and the consol application runs as the logged on domain user (my
    > account). So I'm back to permissions again, and hope someone can help me.
    >
    > Regards
    > Elin Kolloen
    >
    >
    > "Kevin Spencer" <> wrote in message
    > news:...
    > > The error message indicates that one of two possible things happened:
    > >
    > > 1. The Login Failed
    > > 2. A Network issue prevented the request from reaching the SQL Server.
    > >
    > > It is a relatively simple matter to find out if the login failed (which
    > > isn't likely in your case, because it can connect to the same machine's

    > SQL
    > > Server, which I presume is set up the same?). In any case, you can set

    up
    > > SQL Profiler on the target machine to audit logins. If you do this, and

    > run
    > > your app, you will see whether or not the login was attempted. If not,

    > it's
    > > a network issue.
    > >
    > > If it is a network issue, it could one of several possibilities. Your

    best
    > > bet in that case would be to talk with your Network Admin about the

    > problem.
    > >
    > > --
    > > HTH,
    > >
    > > Kevin Spencer
    > > Microsoft MVP
    > > .Net Developer
    > > http://www.takempis.com
    > > Neither a follower nor a lender be.
    > >
    > > "Elin Asphjell" <> wrote in message
    > > news:...
    > > > The SQL server has both windows authentication and sql server

    > > authentication
    > > > enabled. I'm sending the sql server login id and password in the
    > > > connectionstring. The connectionstring looks like this:
    > > > "Data Source=SERVERNAME;Inital Catalog=DATABASENAME;User
    > > > ID=LOGINNAME;Password=PASSWORD". The error message is:
    > > > "System.Data.SqlClient.SqlException: SQL Server does not exist or

    access
    > > > denied." Since I know the server exists and I can connect with my

    consol
    > > > app, I'm guessing it's a permissions problem.
    > > >
    > > > Regards
    > > > Elin Kolloen
    > > >
    > > > "Kevin Spencer" <> wrote in message
    > > > news:...
    > > > > Is the SQL Server using Windows Authentication or SQL Server
    > > > authentication?
    > > > > What does your Connection String look like? And what is the exact
    > > > > "permission denied message?"
    > > > >
    > > > > --
    > > > > HTH,
    > > > >
    > > > > Kevin Spencer
    > > > > Microsoft MVP
    > > > > .Net Developer
    > > > > http://www.takempis.com
    > > > > Neither a follower nor a lender be.
    > > > >
    > > > > "Elin Asphjell" <> wrote in message
    > > > > news:...
    > > > > > Hi
    > > > > >
    > > > > > I'm developing a web application in dotnet/csharp that connects to

    a
    > > sql
    > > > > > server using the SqlConnection object. The problem is that I cant

    > open
    > > a
    > > > > > connection to the database when it is located on a different

    > computer
    > > > than
    > > > > > the webserver. I get a permission denied message. When I move the
    > > > connect
    > > > > > code into a consol application , I can open the connection. So I

    > guess
    > > > the
    > > > > > asp.net user has too few permissions? Can someone help me? The web
    > > > > > application has security set to anonymous access and the

    intecrated
    > > > > security
    > > > > > checkbox is checked.
    > > > > >
    > > > > > Regards
    > > > > > Elin Kolloen
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Kevin Spencer, Aug 15, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Biggie
    Replies:
    1
    Views:
    3,666
    Alvin Bruney [MVP]
    Feb 6, 2004
  2. JT
    Replies:
    2
    Views:
    427
    Norman Yuan
    Jul 5, 2007
  3. Aaron Scott
    Replies:
    0
    Views:
    238
    Aaron Scott
    May 14, 2010
  4. John Giblin

    Access Denied to sqlConnection

    John Giblin, Jul 15, 2003, in forum: ASP .Net Security
    Replies:
    1
    Views:
    174
    Naveen K Kohli
    Jul 17, 2003
  5. Wesley Chen
    Replies:
    0
    Views:
    248
    Wesley Chen
    Apr 7, 2009
Loading...

Share This Page