Solved

Login failed for user 'null"

Posted on 2009-05-07
12
330 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
ID: 24329071
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
ID: 24329178
Yes the server is set for mixed mode
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24329195
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
ID: 24329245
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
ID: 24330242
You might need the full domain for the user
 
 WTE@domain.com
0
 

Author Comment

by:9apit
ID: 24330614
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 12

Expert Comment

by:williamcampbell
ID: 24330664
Can you Ping the Machine Name?
0
 
LVL 18

Expert Comment

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

Expert Comment

by:David Robitaille
ID: 24331383
0
 

Accepted Solution

by:
9apit earned 0 total points
ID: 24331424
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
ID: 24331784
Did any of our answers rule out possibilities and help you arrive at your answer quicker?
0
 

Author Comment

by:9apit
ID: 24331819
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run time Error 4 34
Error on link 14 38
Javascript and Jquery not firing 9 40
C#.NET and microsoft certification. 3 34
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

14 Experts available now in Live!

Get 1:1 Help Now