Login failed for user 'Servername\ASPNET'.

Posted on 2006-05-12
Last Modified: 2008-01-09
I am trying to connect to my SQL 2005 Server through an aspx page using window authentication. I get the error message.  My connection string is:       
conNorthwind = new SqlConnection( @"Server=localhost;Integrated Security=SSPI;Database=Northwind" );
My server is named SaintAndrews.  I get the following error  Login failed for user 'SaintAndrews\ASPNET'.

Can anyone help me out with this?
Question by:daforga
    LVL 11

    Expert Comment

    It sounds like you are using a trusted security context in your Sql connection string. Try removing the trusted connection goop from the string and adding a valid Sql Server username and Password. Alternately you can give the ASPNET account access to the database in Sql Enterprise
    LVL 16

    Accepted Solution


    conNorthwind = new SqlConnection
    (@"Server=localhost;Integrated Security=SSPI;id=sa;password=;Database=Northwind" );
    LVL 6

    Expert Comment

    Go to your Sql Server,  create new user account with the name : ASPNET and give it permission on your desired tables.

    Have fun!

    Author Comment

    actually it is in SQL 2005, so I need3ed to say "user id"  but,  Thanks Mike MCSD.  It worked.   Yay!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now