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

Hello everyone,

I have a local IIS (WinXP) and a remote SQL Server 2005 DB.  When I try to run login using the aspnetdb, I get the following error:

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

When I run the form in debug mode from Visual Web Developer 2005 Express it works fine.  In other words when the VWD launches the web page as http://localhost:1234 it works, but when I run the same page from http://localhost I get the error.

I know this is permission issues.  I did a search and found info to add the ASPNET user to the DB, but the only user the DB can add it the ASPNET from that server not the computer running IIS.

I am REALLY pulling my hair out on this.  I have been working on this all day, and I KNOW it will be something silly I missed.

Please help!!

 

-Joe

0
joezyz
8/29/2007 11:29:25 PM
asp.net.installation-setup 5668 articles. 1 followers. Follow

25 Replies
1112 Views

Similar Articles

[PageSpeed] 31

Yeah, can you give us your connection string... the problem is either you aren't specifying a User ID and Password, or you're not specifically saying that you are a TRUSTED_CONNECTION...


-Timothy Khouri
http://www.SingingEels.com/
Developer / Architect / Author
0
Nullable
8/30/2007 1:44:36 AM

Thanks for the reply.  I have tried it both ways.  First:

<add name="LocalSqlServer" connectionString="data source=MSSQLSERVER;Integrated Security=SSPI;Initial Catalog=aspnetdb"/>

Second:

<add name="LocalSqlServer" connectionString="Data Source=MSSQLSERVER;Initial Catalog=aspnetdb;User ID=Raptor_Website_User;Password=Raptor_Website_User; Trusted_Connection=yes" providerName="System.Data.SqlClient"/>

Here are the strings I have used.

Thanks again.

-Joe

 

Here are the SQL SERVER Log Errors:

08/29/2007 22:39:05,Logon,Unknown,Login failed for user ''. The user is not associated with a trusted SQL Server connection. [CLIENT: 192.168.1.18]
08/29/2007 22:39:05,Logon,Unknown,Error: 18452<c/> Severity: 14<c/> State: 1.
08/29/2007 22:39:05,Logon,Unknown,SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 192.168.1.18]
08/29/2007 22:39:05,Logon,Unknown,Error: 17806<c/> Severity: 20<c/> State: 2.

 Thanks!!

 

0
joezyz
8/30/2007 2:33:51 AM

OK, you're very close... either add "Trusted_Connection=True" to the first one... or remove it from the second one (if you are passing a user id and password, then the connection isn't "trusted" by default... you are saying... 'hey, don't trust me for no reason... I've got the name and password to prove myself!')

joezyz:
<add name="LocalSqlServer" connectionString="data source=MSSQLSERVER;Integrated Security=SSPI;Initial Catalog=aspnetdb"/>

<add name="LocalSqlServer" connectionString="data source=MSSQLSERVER; Integrated Security=SSPI; Initial Catalog=aspnetdb; Trusted_Connection=True;" />

Or you could do:

joezyz:
<add name="LocalSqlServer" connectionString="Data Source=MSSQLSERVER;Initial Catalog=aspnetdb;User ID=Raptor_Website_User;Password=Raptor_Website_User; Trusted_Connection=yes" providerName="System.Data.SqlClient"/>

<add name="LocalSqlServer" connectionString="Data Source=MSSQLSERVER;Initial Catalog=aspnetdb;User ID=Raptor_Website_User;Password=Raptor_Website_User;" providerName="System.Data.SqlClient"/>

Lemme know how it works out for you :)


-Timothy Khouri
http://www.SingingEels.com/
Developer / Architect / Author
0
Nullable
8/30/2007 11:37:11 AM

Good morning Tim,

Still the same error.

I think the key to this is if we are able to answer the 2 dollar question. Why does it work when I run the website in the debug mode of visual web developer and not when I run it directly with IIS?

Works:

http://localhost:1257/RAPTOR/

Does Not Work:

http://localhost/login.aspx

Thanks for all the help.

-Joe

0
joezyz
8/30/2007 12:19:10 PM

Tim,

I went back and tried the connection string without the trusted connection and it worked.  As a worst case, I will take it, but do you or anyone else know why the top one is (SSPI) not working?

At least the bottom one that passes a name and password.

Thanks!!

-Joe

0
joezyz
8/30/2007 12:25:53 PM

Hi there,

Could i please see your complete web.config and then I can give you an explanation of whats happening.

many thanks


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 1:54:54 PM

Here it is:

 

<?xml version="1.0"?><!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<
configuration>

<appSettings/>

<connectionStrings>

<remove name="LocalSqlServer" />

<add name="LocalSqlServer"

connectionString="data source=MSSQLSERVER;Initial Catalog=aspnetdb;Integrated Security=SSPI;Trusted_Connection=True; "/>

</connectionStrings>

<system.web>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<roleManager enabled="true" />

<compilation debug="true"/>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

</system.web>

</configuration>

0
joezyz
8/30/2007 1:59:32 PM

Hi there,

Your web.config has put me into a little offtrack but I will try to explain this as a possible reason. First of all let me also ask you that have you got any firewall enabled? What OS is it?

For the second question i think the problem is that the user that you are running as doesnt have SSPI permission, meaning your window account doesnt have access to default SQl, perhaps when you installed it you did a named instance installaion or if it is on the network it doesnt have the SSPI permission.

The username and password you are using however has that permission and so it works fine with that.

Please read here http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395

If you provide me above questions then I shall be able to answer about localhost and localhost with port query.

Hope this helps

 

 


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 2:26:52 PM

Hi Naturehermit,

I have gone through the link and changed my setup to be exactly like Scenario 3 - Using Windows Authentication with IIS and the Database on different Machines. I get the same error.

To answer your questions:

Firewall, yes.  I have opened ports TCP 1433 and UDP 1434.  I have opened up the firewall to both SQL Server excuitibles. 

OS - The web client and SQL Server are on XP Pro with all the latest patches and SP's.

 

Other Info:  SQL is allowin SQL and Windows auth. I also run SQL Server Management Studio from the web server and I can connect without any issues with All the logins.

Thanks!!

 

 

 

0
joezyz
8/30/2007 3:15:41 PM

Hi there,

Atleast this one is line with my expectation.

First of all the application work at localhost:1234 is because of the fact that VWD has configured your application to use that port for hosting on Cassini, the in built server that comes with it.

Localhost would simply deny it because of firewall. However

http://localhost  should show you a page from your IIS because it by default points to inetpub/wwwroot. Trying that in firefox will ask you for username and password though :P

Now for second part of the question, please see what security context is your IIS using to run your app.. by here http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=287#ASPNET

then try impersonation.

Hope that will clear it up.

 

 


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 3:23:18 PM

I have these settings:

Sorry I dont know how to get an image up here.  It keeps failing:

 

http://imagebin.org/10167

I also have

<identity impersonate="true" />

 In the web.config file.

Thanks I really appreciate your help!!

0
joezyz
8/30/2007 3:37:47 PM

If you check Allow IIS to control password, then your IUSR account will take on..and then it should actually work with SSPI. Could you try that please.

 


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 3:43:37 PM

Same error with Allow IIS to control Pass.

 

0
joezyz
8/30/2007 3:49:44 PM

 From the image you post i see that the anonymous account has been set to Raptorweblogon.

Which identity were you planning to impersonate.

If you had planned to impersonate the client who logs in --> then you need to uncheck anonymous access.

Just curious what type of account is "RaptorWebLogon"? is it a local account or a domain account? 

 

 

 


Sandeep Antony
0
sandeepantony
8/30/2007 3:56:37 PM

Do you still see Raptor stuff in that username password box. If no then I can still say the same thing that your this (mentioned) account doesnt have SSPI priviliages from the domain server. For a test sake, try a local instance of db on your machine (perhaps sql express) and trust me it will fly with SSPI. If you are the system admin then fine, otherwise I suggest you to look it up with your sys admin.


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 3:56:51 PM

I was following these earlier instructions:

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395#Scenario1Step5

I created a SQL Server login called RaptopWebLogon I gave it dbo privledges.  I can log into the db with this userid from MS SQL Server Management Studio.

Thanks!!

0
joezyz
8/30/2007 4:09:55 PM

Yes, I still the the user name in the box.  According to the instructions you gave me the link for.  I am not using a domain name.  I have tried using an administrattor login and password, but I still get the same error.

I am convinced this is an issues with IIS.  I just dont know how to determine with the actual string being passed to the DB is.  Does anyone know how to look into the command being sent across?

 

-Joe

0
joezyz
8/30/2007 4:30:17 PM

could you remove that name etc and then uncheck the box.

then on a comand prompt

do iisreset/noforce.

Have you tried connecting to a local db with SSPI provided its installed with windows authenticaiton account and not named instance.

 


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
0
naturehermit
8/30/2007 4:32:29 PM

Ok,

I set up a local DB.  Now when I try the same login I get Login failed for user 'DEVSERVER\ASPNET'.

I have the same IIS set up, but somewhere it is defaulting to ASPNET and not the User I want.

 

Any Ideas??

0
joezyz
8/30/2007 5:30:41 PM

 thats because you prabably have Anonymous access still set in IIS.

Uncheck anonymous access, Leave only Integrated Access checked and then try it. 


Sandeep Antony
0
sandeepantony
8/30/2007 6:05:36 PM

I'm Going Nuts!!

 Here is my settings.  I took off anonymous, but still get the Login failed for user 'DEVSERVER\ASPNET'. error.

http://imagebin.org/10170

Is there another place this is set?  Like in the ASP.NET Tab?

0
joezyz
8/30/2007 6:17:46 PM

 

 see if you're set up is close to this

http://msdn2.microsoft.com/en-us/library/ab4e6cky(VS.80).aspx

There are plenty of articles on the net for this type of error. Which is typically due to an incorrect configuration.

As a test try putting an test ASP page which makes connection using the same connection string? ( this should allow IIS to use integrated authentication to pass of the credentials)

 


Sandeep Antony
0
sandeepantony
8/30/2007 9:42:51 PM

joezyz:
- Sorry I haven't posted in a bit (and there has been a lot of conversation past this post)... but, the ultimate reason for the above comment you made is...

localhost:1257 is running from Visual Studio ... under your ubber awesome Administrator login on your computer...

localhost is running from IIS which is under a much wimpier user context... and for some reason your SQL server just don't like it.

That's why I recommended you use the name and password (which works)... that's always the better way to go so that you don't run into crazy other issues like this :)

If your question is answered, please mark the post as the "answer" so that I know the thread is resolved (if not, I'll check back in a few).

Thanks,


-Timothy Khouri
http://www.SingingEels.com/
Developer / Architect / Author
0
Nullable
8/31/2007 2:28:43 AM

All,

Here is what I belive is going on.  I have set up a duplicate DB on my local dev server, The same one that runs IIS.  When I try to log into the DB with SSIP using this:

<add name="LocalSqlServer" connectionString="data source=DEVSERVER;Initial Catalog=aspnetdb;Integrated Security=SSPI" />

<identity impersonate="true"/>

 

In the web.config and using  Anonymous access, a login and password that has privleges to the DB, and Allow IIS to control Password in the IIS setup.

IIS is passing MachineName/ASPNET to the DB for login.

From all my reading and research,  IIS should send the name and password I have in the IIS name/password for anon login, but it does not.

If I code:

 <identity impersonate="true" userName="RaptorWebLogin" password="RaptorWebLogin"/>

Then it passes Machinename/RaptorWebLogin as the name.

I think this is sending the same thing to the remote DB and that is why it cannot log into the DB.

Does anyone know why IIS wont send just UserID and Password?

I thought it took information from Web.config then from IIS settings then from machine.config.

 

What am I missing to make this work with SSPI.  This is an IIS/ASP issue not a DB issue.

Thanks!!

-Joe 

 

 

0
joezyz
8/31/2007 7:27:09 PM

Since this appears to be an IIS/web.config issue, Im going to move the thread over to the configuration and deployment topics.

Thanks for everyone who helped.  I will post an update with the solution once I find it.

-Joe

0
joezyz
8/31/2007 9:10:33 PM
Reply:

Similar Artilces:

Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)
please tellme how to resolve this error, i m using server studio management tool. and trying to connect using sql server authentication. my pc is over a domain.   Login failed for user 'Bachelorplace'. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)  check whether that sql server is allowing sqlauthentication or not.select that server -> right click it-> select  properties  -> in the window, select security -> check what is the server authentication. it should be  sqlserver and windows authentica...

2008 IIS7 connection to SQL Server 2000 on Web Server 2000: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am setting up a windows 2008 IIS7 web server, and trying to connect to a windows 2000 sql server 2000 database. I have an IIS6 Windows 2000 web server activately connected just fine. I have anonymous and windows authentication enabled. And in my web.config I have identity impersonate="true" My sql server 2000 typically uses the IISUSER anonymous user set up in IIS6 on my original windows 2000 web server. But this new IIS7 is giving me grief. I can't seem to setup the IUSR or IISUSER or anything in it. I can't even use sql server credentials in my connection string altho...

Getting error "Login failed for user ''. The user is not associated with a trusted SQL Server connection" on trying to authenticate a user
Hi, I created aspnetdb on Sql Server 2005 and modified my web.config LocalSqlServer connection string to connect to the Sql Server instead of mdf file on Sql Server. When i click Log In button on my login control i am getting the error "Login failed for user ''. The user is not associated with a trusted SQL Server connection" But when i bind a radio button list or any control to select from aspnet_users or roles table data is displayed fine without any login errors (i am using aspnetdbConnectionString given below for binding data). Why is it happening only when i authenticate but...

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Hello All, I'm Getting the following error when calling a dll from my vb.net application. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The dll was written in vb6 and accesses a sql db using the following connection string. Public Const GLOBAL_DNS As String = "DSN=TransSrvFinal;UID=sa;PWD=admin;" This DLL works fine when called from other Windows Apps. However I'm now trying to call this dll from with in an asp.net application. I'm using vb.net as the codebehind. I'm a...

Login failed for user ''. The user is not associated with a trusted SQL Server connection
 Hi to all......... In my project I am using windows authentication and if I am running through the IIS getting this error. Suppose if I am directly run the project or use server authentication then I wont get this error.My web.config file is <?xml version="1.0"?><configuration>  <configSections>    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">  ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection.?
Hello, I just got a copy of a website I was supposed to be working on.  I went to the web.config file changed the machine name to my machine's name and when I try to run the program I get the following error.  Could someone give me some advice on how to fix this ?  Thanks! On your production site, the site passes the web user's credentials (your IUSER account) to your sql server.   Make sure that your local site is set up to pass your credentials along to the sql server.  In your web.config, add identity impersonate=true. --JJPlease mark ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #4
Arrgh!  I've check and to make sure SQL Server and Windows Authentication option is selected.  The user has Grant access to connect to database engine and Login is enabled...and also has database read/write privs.  I can login using the username/password from Mangement Studio Express, but I can't from my app.  Here is my web.config: <connectionStrings>    <add name="CPT_ConnectionString"          connectionString="Data Source=192.168.1.40\ccsql1;Integrated Security=SSPI;" &nb...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #5
hello i am working on a web application where the application and data base are not on the same serverso when trying to connect to the data base from the web application using windows authentication i got that errorLogin failed for user ''. The user is not associated with a trusted SQL Server connection. when i used user id and password the problem solvedcan any one tell me how to make my application run using  windows authenticationone thing else ;this problem raised  after another issuse came from the network that the server is not able to resolve the address or ip of th...

Login failed for user 'test'. The user is not associated with a trusted SQL Server connection.
Hi all, I am new in asp.net. In my web.config file, I wrote the connection strings as below and then I got the above error. I already changed SQL server Authentication mode to "SQL server and Windows". Any idea? Thanks in advance. <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=xxx;Initial Catalog=mydb;User ID=test;Password=test;Persist Security Info=False;" providerName="System.Data.SqlClient" /> </connectionStrings>  Hi, If you are using...

Login failed for user 'testuser'. The user is not associated with a trusted SQL Server connection.
Hi, I have a copy of VS2005 and i have installed the Microsoft SQL Server Developer Edition I am trying to do my first connection using ASP.net (yay for me...) and it has failed...with this error..Login failed for user 'testuser'. The user is not associated with a trusted SQL Server connection.   can someone please point out why? yes i know that the error seems pretty straight forward but how do i fix it? like how do i make the user a trusted server connection? where do i do it? and what are the steps? the user is an administrator and by rights should have all access to everything....

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #2
I've seen many, many, many, many posts regarding this topic - but none have been able to fully explain nor fix my problem.I've developed a security solution according to Scott Gu's guide and it works great - but only on my local machine running VWD and SQLExp2005. Once I move this application it completely breaks in the productions environment.  Today I managed to get it halfway there. I created a SQL login and changed my web.config to use these credentials - now the web application will come up, but none of my links (that are role based) are displayed - most likely because ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #3
Hi I'm making a website and will upload it next via ftp but i need to access the local server for database retrieval from this website. i'm doing so first time so not sure about its working and isues. Through google search and from forums i collect some info to work on it. now i have made a connection string to access remotely that gives the following error when i make the connection open  "Login failed for user ''. The user is not associated with a trusted SQL Server connection." the local server use the windows authentication mode or may be the mix mode. ...

Login failed for user ''. The user is not associated with a trusted SQL Server connection. #6
Hi,        I developed an intranet web application using ASP.NET.Everything works fine in dev environment.Right now we want to test in QA. I have used windows authentication.The web.config file has the following connection string: <add     name="DatabaseConnection"  connectionString="Data Source=(QA);Integrated Security=SSPI;Initial Catalog=databaseII;" /> when the application was tested in QA,it displays the windows login. But I am getting        Login failed for user ...

Web resources about - Login failed for user ''. The user is not associated with a trusted SQL Server connection. - asp.net.installation-setup

Resources last updated: 12/10/2015 2:22:38 PM