Solved

Login failed for user 'null"

Posted on 2009-05-07
12
329 Views
Last Modified: 2013-12-17
Good afternoon expert,

Using
    <connectionStrings>
        <add name="TimeEntry_bConnectionString" connectionString="Data Source=labsdirvg600;Initial Catalog=TimeEntry_b;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
I get

Login failed for user '(null)'. Reason: 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 '(null)'. Reason: Not associated with a trusted SQL Server connection.

So i found a service account called WTE at the SQL server with a login and made WTE a user on the database. Then I made WTE a user on the Web server and at Edit Anonymous user on the IIS property of the web site mad the user WTE.

THen changed the web.config to
    <appSettings/>
    <connectionStrings>
        <add name="TimeEntry_bConnectionString"
       
        connectionString="Server=labsdirvg600;Database=TimeEntry_b;User ID=WTE;Password=King0n1;Trusted_Connection=False;"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
I then get
Login falied for user WTE

What am I doing wrong?

Thanks

Allen In Dallas
0
Comment
Question by:9apit
  • 5
  • 4
  • 3
12 Comments
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
check under properties of the SQL server (Right click), in "security" page (on left), make sure the server authentication is set to "SQL SERVER and Windows Authentication Mode"
0
 

Author Comment

by:9apit
Comment Utility
Yes the server is set for mixed mode
0
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
then try with SA (if you have the password)
if it work, you will know it<s a problem int the SQL server  user.
0
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
you could also try this
connectionString="Data Source=labsdirvg600;Initial Catalog=TimeEntry_b;User ID=WTE;Password=King0n1;Persist Security Info=True"

0
 
LVL 12

Expert Comment

by:williamcampbell
Comment Utility
You might need the full domain for the user
 
 WTE@domain.com
0
 

Author Comment

by:9apit
Comment Utility
Tried it both ways with and with the domain name. Same result. Inserted    
 <identity impersonate="true" /> in web.config.
The web app worked on the local machine but not on any remote
computer. And when iinserted the name of the machine in the URL
in address instead of 'localhost' the error reappeared. Wierd.
THen after that the Login failed for user 'null" appears on the local
machine no matter how I call it.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 12

Expert Comment

by:williamcampbell
Comment Utility
Can you Ping the Machine Name?
0
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
and doid you allow TCP/ip for the SQL server?
0
 
LVL 18

Expert Comment

by:David Robitaille
Comment Utility
0
 

Accepted Solution

by:
9apit earned 0 total points
Comment Utility
Success.

There are two types of connection strings.
One uses a trusted connection. The other uses
a username and password. Used the latter
and set up an account with those credentials at the DB.

I think my mistake was thinking that the
the credentials at the web server had to be
the same as the credential at the SQL Server.
It is true that the log in the local Windows user has to be the
same as the Anonymous User at the IIS
Properties. This calls the web.config.
Then the credentials in the web.config have to
be the same as the credentials in the SQL server
security login. But the credentials at the web server
do not have to match authentication at the DB
server.
 
Allen
0
 
LVL 12

Expert Comment

by:williamcampbell
Comment Utility
Did any of our answers rule out possibilities and help you arrive at your answer quicker?
0
 

Author Comment

by:9apit
Comment Utility
Good evening Mr. Campbell,

Perhaps the problem that I posed is so integrated to the
environment in which I was troubleshooting that it would
be almost impossible for someone not in that environment
to take an deductive approach to a solution.

To answer your question, no, only one of thel the answers
I got had to do with the connection string and it wasn't
even close.

Thanks.

Allen
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

11 Experts available now in Live!

Get 1:1 Help Now