.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Login failed for user '...\ASPNET' only with parameterized query using SQL Server Authentication

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :ASP.Net

Hi there,

I've narrowed the problem down to the following:

  • Receive "Login failed" for user ASPNET error message
  • SQL Server 2005 is db and IIS is web server (both on same computer)
  • Mixed authentication used on SQL Server
  • I have created user ASPLogin with password that is correctly typed int the web.config:


add name="masterConnectionString" connectionString="Data Source=computername\GMOSERVER;Initial Catalog=Portal;Persist Security Info=True;User ID=ASPLogin;Password=password<

View Complete Post

More Related Resource Links

Login Failed for User "XXX" when login from a ETL machine for Sql Server 2005 SP2

Hi Guys, I have a straange issue with Login Failed errors coming intermittently probabaly twice in a week: I have a  production Database on Server A and we have Two ETL servers on Server B and Server C. Sometimes when the ETL's (SSIS) run from SERVER B I do get an error stating login failed for user "XXX" this user is a sql server user. And when I run the same package from Server C it does not give any error and runs smoothly. Both the packages uses the same configuration file to connect to the same database with the same user credentials. Also this error is not a frequent error but comes along once or twice in a weeK. Can anyone shed some light on this and let me know the root cause. Both servers have the same sql client version as well. All servers mentioned above are 64 bit windows 2003 servers. Raju

SQL Server 2005 "Login failed for user" sa

I have not been able to install SQL Express SP2 (standard or advanced) on Vista Ultimate (RTM). Every time I try to install, I get the following error message: SQL Server Setup could not connect to the database service for server configuration. The error was: [Microsoft][SQL Native Client][SQL Server]Login failed for user 'sa'. Refer to server error logs and setup logs for more information. When I check the logs, the only information I can find that is at all useful is: Doing Action: Do_sqlScriptPerfTime Start: Do_sqlScript : Thu Mar 01 21:35:42 2007Service MSSQL$SQLEXPRESS with parameters '-m SqlSetup -Q -qSQL_Latin1_General_CP1_CI_AS -T4022 -T3659 -T3610 -T4010' is being started at Thu Mar 01 21:35:42 2007SQL service MSSQL$SQLEXPRESS started successfully waiting for SQL service to accept client connectionsService MSSQL$SQLEXPRESS started at Thu Mar 01 21:35:48 2007SQL_ERROR (-1) in OdbcConnection::connectsqlstate=28000, level=-1, state=-1, native_error=18456, msg=[Microsoft][SQL Native Client][SQL Server]Login failed for user 'sa'.         Error Code: 0x80074818 (18456)Windows Error Text:   Source File Name: lib\odbc_connection.cppCompiler Timestamp: Wed Jun 14 16:28:15 2006     Function Name: OdbcConnection::connect@connectSource Line Number: 148 Has anyone else run into this issue and resolved it? I have seen posts for earlier versions of SQL Express that said to run

PassThrough authentication fails: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

I've tried it with every AuthenticationMode! But no one seems to work correctly in my case. I thought that PassThrough should work with a preset User ID and password. This would be enough for the moment, but even this doesn't work!! With WindowsCredentials I get the following error: The Property with name 'SsoApplicationId' is missing on the LobSystemInstance. SsoApplicationId I tried to set this with the SharePoint SSO but I've no such services. How can I set this just for the current WindowsCredentials (of the current Sharepoint user)? With RevertToSelf I get the following error: "An error occurred while retrieving data from MyLOBInstance. Administrators, see the server log for more information." The server log contained no useful information for me. With PassTrough I get the following error: "Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. [CLIENT: <local machine>]" Why are the lines <Property Name="RdbConnection User ID" Type="System.String">MyDomain\Administrator</Property><Property Name="RdbConnection Password" Type="System.String">mYpAssWoRd</Property> being ignored? Everything (MOSS, SQLServer,...) is on a single machine, so I don't need to activate Kerberos, do I? <LobSystemInstance Name="SEPInstance1207">   <Properties>    <Property Name="DatabaseAccessProvider" Type="Micros

Login failed for user 'XXX'. Reason: Attempting to use an NT account name with SQL Server Authenti


Under a network service account. I want to perform some operations on the SQL server DB.

I am passing the user id and password of the admin on that box. Still I am getting Login failed for user 'XXX'. Reason: Attempting to use an NT account name with SQL Server Authentication.

Is there any way i can connect to Sql server with user id and password?

Connection string i am using is Data Source=imdbstrs22;Initial Catalog=DataStore;Integrated Security=false;user Id=XXX;password =Imdbaug#10;





Login failed for user: Reason:Token-based server access validation failed with an infrastructure err



I have installed a named instance of SQL Server 2008 R2 Enterprise 64 bit on Windows Server 2008 R2 Enterprise 64 bit. The os is running as a VM ware virtual machine.

I have created an AD security group for database engine sys admins on that machine. I added my user to that group.So for example;

domainname\machinename_SQL_DBE_SysADmins is a user with SysAdmin server role permissions. User domainname\MichaelEFF is a member of this group.

When I log onto the machine as this user and run the management studio with run as administrator I cannot log into the database engine. The log shows the error:

Login failed for user: Reason:Token-based server access validation failed with an infrastructure error

I've read many posts where the MVP says that the UAC is not passing the group membership. Is this the case? If so then how will role based access ever be possible with windows authentication? How can this be resolved?




Login failed for user:Token-based server access validation failed with an infrastructure error


I would appreciate help with the following issue:


I have created a local group in our SQL 2008 server and added two Windows user accounts "DOMAIN\UserName"  I  then added the local group to the database and granted read only access.


The users are trying to link tables using MS Access using and ODBC connection and getting the following error.

Users are not system administrators.


Date                      6/30/2010 1:01:54 PM

Log                         SQ

SQL Server: Login failed for user: '\$'



I hate to be the 12345th person to request assistance on this topic, but despite looking at previous requests, I can't seem to find the solution. Any assistance you could offer would be much appreciated.


I have a new ASP.NET 2.0 web application which is hosted on (for argument's sake) WEBSERVER (using IIS 6.0), and which accesses data on SQLSERVER (using SQL Server 2000).

Because this is an intranet application, I want the application's authentication mode to be Windows, and the IIS authentication mode to be Integrated Windows (with Anonymous access disabled). ie: IIS should authenticate the user as smithjohn and SQLSERVER should also authenticate the user as smithjohn.

I don't know if this is relevant, but because of an existing nasty Windows application, all relevant domain users already have their own <DOMAIN>\<username> User account on SQLSERVER.


When I build and browse the pages in Visual Web Developer Express, I can retrieve information from SQLSERVER without any problems.

When I publish the site, and upload it to WEBSERVER, I get the following error upon attempting to retrieve data from a stored procedure on SQLSERVER:


Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.


I have been using my workstation on a Windows 2000 SQL Server network for several weeks without any issues. I am using Activant Prophet 21 accounting software along with MS Office 2010 Professional on a Windows 7 Ultimate platform. I recently upgraded to the new Windows Live. While working with Access today, I suddenly lost connection to the server (also my internet server). I received the following message:

Unable to connect
SQLSTATE = 42000
Microsoft OLE DB Provider for SQL Server
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Potential Reasons:

1. Invalid User Name 

2. Invalid Password

3. Invalid Server Name

4. Invalid Database Name

 Any suggestions?

P.S. I am able to access the SQL Server using my user name from a different (Window XP) workstation (i.e. database functions and internet access)


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

First at all, My name is Yuri.
I have a problem with SQL server 2005 when I want to select data from sql server database on another machine and then insert data to local sql server 2005 database. And I Have checked that authentication mode for both sql server database is mixed mode.
If anybody can give suggestion for my problem, many thanks before.

Best Regards,


Login failed for user sa Microsoft Sql Server 18456


Its unbelievebale that I am not able to login using my sa password .I am setting it by loggin into windows mode still it is giving error

Login failed for user sa Microsoft Sql Server 18456



Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456, Severity: 14, State: 1) When I us


When I use the following setting to connect server, it succeeds
Server type: Database Engine
Server name: Home-PC
Authentication: Windows Authentication

User name: Home-PC\John

However, when I try to use the following setting to connect the same server, it fails as always
Server type: Database Engine
Server name: Home-PC
Authentication: SQL Server Authentication 

The Error Message as follows
TITLE: Connect to Server
Cannot connect to Home-PC.
Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476

Then, I enter the server to change some

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.


I am receiving the following message when connecting via query analzyer to SQL server using windows authentication.(error 18452). I have a login created with the sys admin server role on the server. When I connect using SQL authentication it works.

I added myself to the local admin group on the server, this allows it to work. The same situation is seen with another user.

I am using windows 2000 sp4 server and SQL 2000 SP3, connecting from NT4. I get the same issue if I use TCP or named pipes. We have been using SQL security but are moving to windows authentication - but this issue is stopping us.

I have checked and upgraded my version of MDAC to match the server version 2.7 (sp1)

Any help would be much appreciated.



Linked server fails -Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. with SQL2008R2


Hi, Kerberos seems to be malfunctioning with SQL2008R2.


I have a new dev SQL2008R2 server called BDSDEV2 and an upgraded(in-place) SQL2008R2 server BDSTEST2.

From BDSDEV2 , I can successfully issue a linked server query to BDSTEST2

select * from bdstest2.eis_prod.dbo.wcs_agent


But from my client in SSMS, connected to BDSDEV2  , the double hop is failing to BDSTEST2 for same query 

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.


I have another BDSDEV1 server, which is SQL2008 and there double hop IS WORKING

From my client in SSMS, connected to BDSDEV1  ,I can successfully issue the query to BDSTEST2 .


The service accounts  for MSSQLSERVER are both local admins on their servers and sa's

I have confirmed SPN is OK 

This is from BDSDEV2 - sql2008r2 server.

C:\Program Files (x86)\Resource Kit>setspn -L tsqlssvc

Registered ServicePrincipalNames for CN=TSQLSSVC,OU=SvcAcct,DC=corp,DC=saif,DC=c


Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.


I have two SQL 2000 Server. Both server needs to communicate with each other. The setup was working for last 8 month. Last week, we disconnected the server 2 from the network and then we reconnected the server 2 again. Now when we tried to call StoredProcedure of Server 2 from Server 1 we get the following error:

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

This used to work.

However if we call storedprocedure of server 1 from server 2, it works just fine.

This is an old problem and this problem has been answered several times. The problem is none of them are working for me.

The main solution that has proposed is that I should set login option to Mixed Mode. My authentication mode has been set to mixed mode, I have also checked the registry and that's ok too. What I can't get what used to work and now it doesn't.


I am completely lost.

Login failed for user 'sa' .The user is not assosiated with a trusted SQL Server Connection.


Dear Friends,

                   I have downloaded a project from



 ,which is an example of 3 tier architecture.

To run this project the author has suggested to change the 'value' in <appsettings> of webconfig file.

previously it was

 <add key="SqlConnect" value="ABRAHAMOS;database=TimeManagement;uid=sa;pwd=moses;" />

I changed it to

 <add key="SqlConnect" value="server=ABC-314FF72122C\SQLEXPRESS;database=TimeManagement;uid=sa;pwd=moses" />

as 'ABC-314FF72122C\SQLEXPRESS'  is the server name of my sqlserver 2005.

when i run the project and try to enter something from a page then error occur as  'Login failed for user 'sa' .The user is not assosiated with a trusted SQL Server Connection.'

what could be the possible reason?????????


Till now I have tried following things:

1. I kept the pwd value blank and tried to run-------- then also the same problem

2.   I kept the pwd value .(dot) and tried to run-------- then also the same problem

3.   I tried to chan

No ASPNET User in Windows Server 2008?


I have been looking everywhere online regarding this, but have not found a clear answer.


I have an ASP.Net app running on Windows Server 2008, it's basically a reporting app using Crystal Reports. I have encountered a roadblock in regards to rendering some pages. When I run the app in Visual Studio(on the same 2008 machine) everything works perfectly. Yet when I publish it and run it live the reports will not display correctly, I get a message saying Failed to render page.


I looked this error up in the Crystal Reports website and the fixes they have there refer to giving the windows "aspnet" user full access rights to certain folders on the machine. I would be happy to do this, however there is no aspnet user in Windows Server 2008.


I installed the server and set its role to be Web Server. I also checked all the options regarding ASP.Net and IIS 6 compatibility. Yet there is no ASPNET username anywhere.


Did I set the server up wrong? or do I have to do something within ASP.Net to  create this user and then give it rights? 

Login failed for user IIS APPPOOL\DefaultAppPool


Any Ideas on how to fix this issue?

Visual Studio 2005, Windows 7 64bit, SQL Server 2005 Express

Cannot open database "sql2" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend