Link to home
Start Free TrialLog in
Avatar of MIS_Nole
MIS_Nole

asked on

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Back story: Last night a Windows 2000 server was demoted and that is when the fun began.

We have a reporting system that runs off a SQL database from our intranet site.  Now when I try to log into the system I get the following error:
 Login failed for user ''. The user is not associated with a trusted SQL Server connection.
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 ''. The user is not associated with a trusted SQL Server connection.

This system was working fine before the demotion.  But we were having AD replication issues so that is the reasoning behind the demotion.  My best guess is that somehow the credentials for the ASPNET account were lost in translation.  Any suggestions?

Here is the code for the DB connection:




using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
 
namespace QIReportingSystem
{
	/// Summary: Holds and maintaines connection to testing database
	/// Notes: Database path is hard-coded.  If you need to be able to dynamically associate the path,
	///			create a constructor that takes the database path and assigns it to the connection string
	/// </summary>
	public class DBLibrary
	{
		private SqlConnection connection;
        private string server;
        private string database;
        private string userID;
        private string password;
        private string connectionString;
   
		public DBLibrary()
		{
            server = Server_Name";
            database = "DB_Name";
            userID = "domain\\ASPNET";
            password = String.Empty;
            connectionString = "server=" + server + ";database=" + database + ";User Id=" + userID +
                ";trusted_connection=true";
		}
 
        public DBLibrary(string database)
        {
            server = Server_Name";
            this.database = database;
            userID = "domain\\ASPNET";
            password = String.Empty;
            connectionString = "server=" + server + ";database=" + database + ";User Id=" + userID +
                ";trusted_connection=true";
        }

Open in new window

SOLUTION
Avatar of Mohed Sharfi
Mohed Sharfi
Flag of Sudan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another one to try is go into the SQL Server Configuration Manager and see if the Named Pipes protocol is turned on. If it is -- turn it off.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial