Server Error in ''/SqlConn2'' Application. Login failed for user ''GABAN\ASPNET''.

  • hello to everybody.....
     
    My PC appear this error message when i want to connect my ASP.NET application (ex : localhost/sqlconn2) to the database : -
     
     

    Server Error in '/SqlConn2' Application.


    Login failed for user 'GABAN\ASPNET'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'GABAN\ASPNET'.

    Source Error:

    Line 9:  
    Line 10:   conPubs = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;database=pubs" );
    Line 11:   conPubs.Open();
    Line 12: }
    Line 13: 

    Source File: E:\ACCP_ZAHER\SqlConn\WebForm1.aspx    Line: 11

    Stack Trace:

    [SqlException: Login failed for user 'GABAN\ASPNET'.]   
    System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +484   
    System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372   
    System.Data.SqlClient.SqlConnection.Open() +384   
    ASP.WebForm1_aspx.Page_Load(Object sender, EventArgs e) in E:\ACCP_ZAHER\SqlConn\WebForm1.aspx:11   
    System.Web.UI.Control.OnLoad(EventArgs e) +67   
    System.Web.UI.Control.LoadRecursive() +35   
    System.Web.UI.Page.ProcessRequestMain() +750


    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
     
     
     
     
    Below is my ASP.NET coding (localhost/sqlconn2/webform1.aspx :-
     
    <%@ Page Language="C#" %>

    <%@ Import Namespace="System.Data.SqlClient" %>

     
    <script runat=server>
     
    void Page_Load(Object sender , EventArgs e)

    {

    SqlConnection conPubs;

     
      conPubs = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;database=pubs" );

      conPubs.Open();

    }

     
    </Script>
     
    Connection Opened!
     
     
     
    CAN SOMEBODY HELP ME !!!!!!!!!!!!!!!!!!
  • Two things really, firstly are you sure your SQL Server name is localhost in the connection string ? Should it be (local) instead. Secondly check your windows account's permissions on the SQL Server.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply