HELP - HELP - HELP

Discussion in 'ASP .Net' started by Guest, Mar 9, 2006.

  1. Guest

    Guest Guest

    Vey simple, but does not work:

    I'm trying to set a data-driven Web page with a GridView control. The steps
    I followed are:

    1. Created a data connection using Database Explorer.
    2. Dropped an SqlDataSource and a GridView control on the page.
    3. Set the data source (configured by using the data connection) and
    selected the this data source for the GridView.
    4. Specified the columns of a table for the GridView.
    5. Ran test successfully.

    But, when I try to view the page on the browser, the following exception is
    thrown:

    System.Data.SqlClient.SqlException: Cannot open database "Test" requested by
    the login. The login failed. Login failed for user 'EP_WKS302\ASPNET'.
    ** (EP_WKS302 is the computer name).

    I'm using the Express Editions of Visual Web Developer 2005 and SQL Server
    2005. The authentication mode for the SQL Server is "Windows Authentication".
    The Web.Config file has the following connection string:
    ........................................................................................................................
    <connectionStrings>
    <add name="TestConnectionString" connectionString="Data
    Source=EP_WKS302\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True"
    providerName="System.Data.SqlClient" />
    </connectionStrings>
    .......................................................................................................................

    Does anybody can help?
     
    Guest, Mar 9, 2006
    #1
    1. Advertisements

  2. When you run a web application, it doesn't run under the currently logged in
    user. Instead, it runs under a special user account, in your case
    'EP_WKS302\ASPNET'.

    So, what you need to do is add a user to your database (doesn't matter what
    name you give it), give it the correct permissions (just give it full
    permissions to get going), then include the user name and password in the
    connection string (which will probably be in your Web.config file.

    Will
     
    William Buchanan, Mar 9, 2006
    #2
    1. Advertisements

  3. Alternatively you can add 'EP_WKS302\ASPNET' logon to the database server.

    Eliyahu
     
    Eliyahu Goldin, Mar 9, 2006
    #3
  4. Guest

    Guest Guest

    I'll try it, but does that mean I should use SQL Server authentication mode
    (since Windows authentication does not work)? I couldn't find instructions in
    Visual Web Developer Guided Tour material...
     
    Guest, Mar 9, 2006
    #4
  5. If you add a logon for 'EP_WKS302\ASPNET' or whatever other account you run
    the application under, you can use Windows authentication.

    Eliyahu
     
    Eliyahu Goldin, Mar 9, 2006
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.