473,760 Members | 8,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Login failed for user '(null)'

I have an ASP.NET 2.0 application that uses Forms Authentication. The
startup page contains just a login control, and the site works well on an
IIS 6 web server. I am now setting the site up on the production web
server, which runs Windows 2008 Server and IIS 7. The login page comes up,
but when I try to log in, I get the error, "Login failed for user '(null)'.
Reason: Not associated with a trusted SQL Server connection." For debugging
purposes, the Windows identity is displayed on the login page, and it is "NT
Authority\Netwo rk Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService .) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Netwo rk Service
has been granted full permissions to the application database, as well as
the ASP.NET membership database on SQL Server. (The SQL Server resides on a
different machine from the web server.) The connection strings section of
web.config is as follows:

<clear/>

<remove name="LocalSqlS erver"/>

<add name="LocalSqlS erver" connectionStrin g="Data Source=Jupiter; Initial
Catalog=aspnetd b;Integrated Security=true"
providerName="S ystem.Data.SqlC lient"/>

<add name="SMS_ConnS tring" connectionStrin g="Data Source=Jupiter; Initial
Catalog=SMS;Int egrated Security=true" providerName="S ystem.Data.SqlC lient"/>

Does anyone know what might be causing the "login failed" of how I can debug
this problem?

Thanks in advance,

Brett
Aug 29 '08 #1
4 3787
On Aug 29, 9:54*pm, "Brett" <bret...@newsgr oup.nospamwrote :
I have an ASP.NET 2.0 application that uses Forms Authentication. *The
startup page contains just a login control, and the site works well on an
IIS 6 web server. *I am now setting the site up on the production web
server, which runs Windows 2008 Server and IIS 7. *The login page comesup,
but when I try to log in, I get the error, "Login failed for user '(null)'.
Reason: Not associated with a trusted SQL Server connection." *For debugging
purposes, the Windows identity is displayed on the login page, and it is "NT
Authority\Netwo rk Service". *Anonymous authentication is enabled and uses
the application pool identity (NetworkService .) *Impersonation is enabled
and uses the authenticated user's identity. *NT Authority\Netwo rk Service
has been granted full permissions to the application database, as well as
the ASP.NET membership database on SQL Server. *(The SQL Server resideson a
different machine from the web server.) *
Brett, NT Authority\Netwo rk Service are local accounts and SQL cannot
recognize the user from the other server. You will need a domain
account.
Aug 29 '08 #2
On Aug 29, 11:01*pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Aug 29, 9:54*pm, "Brett" <bret...@newsgr oup.nospamwrote :
I have an ASP.NET 2.0 application that uses Forms Authentication. *The
startup page contains just a login control, and the site works well on an
IIS 6 web server. *I am now setting the site up on the production web
server, which runs Windows 2008 Server and IIS 7. *The login page comes up,
but when I try to log in, I get the error, "Login failed for user '(null)'.
Reason: Not associated with a trusted SQL Server connection." *For debugging
purposes, the Windows identity is displayed on the login page, and it is "NT
Authority\Netwo rk Service". *Anonymous authentication is enabled and uses
the application pool identity (NetworkService .) *Impersonation is enabled
and uses the authenticated user's identity. *NT Authority\Netwo rk Service
has been granted full permissions to the application database, as well as
the ASP.NET membership database on SQL Server. *(The SQL Server resides on a
different machine from the web server.) *
This may help you

Granting Access to a Remote SQL Server
http://msdn.microsoft.com/en-us/library/ms998320.aspx

If you are accessing a database on another server in the same domain
(or in a trusted domain), the Network Service account's network
credentials are used to authenticate to the database. The Network
Service account's credentials are of the form DomainName\AspN etServer
$, where DomainName is the domain of the ASP.NET server and
AspNetServer is your Web server name.

For example, if your ASP.NET application runs on a server named SVR1
in the domain CONTOSO, the SQL Server sees a database access request
from CONTOSO\SVR1$.

To access a remote SQL Server using Network Service

To grant access to a remote database server in the same domain or a
trusted domain, follow the steps described earlier for a local
database, except in step 4, use the DomainName\AspN etServer$ account
to create the database login.

Note In production environments, you should place the network
service account into a Windows group and create a SQL Server login for
the Windows group.
Aug 29 '08 #3
Hi Brett,

As Alexey has mentioned, the problem you encounter is likely due to the
current IIS worker process account(Network Service) doesn't have permission
to access the remote SQL server instance. Though your ASP.NET application
is using forms authentication, it will use windows authentication when try
accessing the sql datdabase(on remote machine) when query the database for
authentication validating. I think on your development environment, the
worker process account have enough permission to access the backend
database.

As Alexey also recommend, you can try granting your network service account
the permission to the remote SQL server instance. Or you can consider grant
a group membership to that account(should be a domain group) which also
apply to the remote SQL machine and have permission to access the certain
SQL database.

Here is a security guideline article for ASP.NET:

#Security Guidelines: ASP.NET 2.0
http://msdn.microsoft.com/en-us/libr...lines0001_data
access

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Brett" <br*****@newsgr oup.nospam>
Subject: Login failed for user '(null)'
Date: Fri, 29 Aug 2008 15:54:14 -0400
>
I have an ASP.NET 2.0 application that uses Forms Authentication. The
startup page contains just a login control, and the site works well on an
IIS 6 web server. I am now setting the site up on the production web
server, which runs Windows 2008 Server and IIS 7. The login page comes
up,
>but when I try to log in, I get the error, "Login failed for user
'(null)'.
>Reason: Not associated with a trusted SQL Server connection." For
debugging
>purposes, the Windows identity is displayed on the login page, and it is
"NT
>Authority\Netw ork Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService .) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Netwo rk Service
has been granted full permissions to the application database, as well as
the ASP.NET membership database on SQL Server. (The SQL Server resides on
a
>different machine from the web server.) The connection strings section of
web.config is as follows:

<clear/>

<remove name="LocalSqlS erver"/>

<add name="LocalSqlS erver" connectionStrin g="Data Source=Jupiter; Initial
Catalog=aspnet db;Integrated Security=true"
providerName=" System.Data.Sql Client"/>

<add name="SMS_ConnS tring" connectionStrin g="Data Source=Jupiter; Initial
Catalog=SMS;In tegrated Security=true"
providerName="S ystem.Data.SqlC lient"/>
>
Does anyone know what might be causing the "login failed" of how I can
debug
>this problem?

Thanks in advance,

Brett
Sep 1 '08 #4
Alexey, you are correct. Thank you!

Brett

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:77******** *************** ***********@l42 g2000hsc.google groups.com...
On Aug 29, 11:01 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Aug 29, 9:54 pm, "Brett" <bret...@newsgr oup.nospamwrote :
I have an ASP.NET 2.0 application that uses Forms Authentication. The
startup page contains just a login control, and the site works well on
an
IIS 6 web server. I am now setting the site up on the production web
server, which runs Windows 2008 Server and IIS 7. The login page comes
up,
but when I try to log in, I get the error, "Login failed for user
'(null)'.
Reason: Not associated with a trusted SQL Server connection." For
debugging
purposes, the Windows identity is displayed on the login page, and it is
"NT
Authority\Netwo rk Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService .) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Netwo rk Service
has been granted full permissions to the application database, as well
as
the ASP.NET membership database on SQL Server. (The SQL Server resides
on a
different machine from the web server.)
This may help you

Granting Access to a Remote SQL Server
http://msdn.microsoft.com/en-us/library/ms998320.aspx

If you are accessing a database on another server in the same domain
(or in a trusted domain), the Network Service account's network
credentials are used to authenticate to the database. The Network
Service account's credentials are of the form DomainName\AspN etServer
$, where DomainName is the domain of the ASP.NET server and
AspNetServer is your Web server name.

For example, if your ASP.NET application runs on a server named SVR1
in the domain CONTOSO, the SQL Server sees a database access request
from CONTOSO\SVR1$.

To access a remote SQL Server using Network Service

To grant access to a remote database server in the same domain or a
trusted domain, follow the steps described earlier for a local
database, except in step 4, use the DomainName\AspN etServer$ account
to create the database login.

Note In production environments, you should place the network
service account into a Windows group and create a SQL Server login for
the Windows group.
Sep 5 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14635
by: TBone | last post by:
Anyone, I have a user "john" whose machine is part of the "job" domain. He is trying to establish an odbc connection to an MS SQL 2000 server on the "school" domain. He uses Windows authentication to establish the odbc connection however it gives the error "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." I am guessing that the odbc connection is trying to pass the credentials of job\john...
0
1576
by: jamesa | last post by:
I am a beginner and trying my first C# application. Any reason why I am getting the message Login failed for user 'admin' I have thoroughly checked the security settings in the sql server. Find my code below. using System; using System.Collections; using System.ComponentModel; using System.Data;
1
2609
by: Mike P | last post by:
I have some login code that works fine on several local machines, but always fails when uploaded. I think it has something to do with encryption. Here is the Submit_Click event which when the code is uploaded always sets newUser to null, so I always get 'Login failed'. PhilePrincipal.ValidateLogin is called to set the value of newUser and this involves encryption (see code below). That is the only reason I can think of why it is not...
4
7227
by: rrober07 | last post by:
Hello, My Setup is I have a Web Server machine(Devweb01), Database SQL Machine(Devsql01), a Client Machine(local machine) I have configured the SQL machine as follows: 1) Added local Aspnet user account (with same password as aspnet user on IIS (Devweb01)) 2) edited local machine.config file <ProcessModel> Password attribute to same password (both on IIS and SQL Machine) 3) SQL Server security is Sql Server and Windows
3
1986
by: Nicola Marchiori | last post by:
Hi I need some help. I am developing a Web App in one PC running IIS. I am trying to connect to to MSDE on another PC, but it's not working. This is the message i got Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
0
1216
by: Don | last post by:
When I attempt to access a SQL Server database from my ASP.NET 1.1 application I get the folllowing error: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. I have impersonate set to true with the following setting in my web.config file. <identity impersonate="true" userName="" password=""/> This project had been working fine. A few weeks ago I installed Visual
6
12776
by: Not Me | last post by:
Hey, We have an sql server 2000 machine and IIS 6 machine running seperately but on the same domain. I can connect fine to the database without using impersonation, but when it's enabled I get the error: "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." When I check System.Security.Principal.WindowsIdentity.GetCurrent().Name I get the valid domain user that I would expect, why isn't this...
0
1516
by: Daniel Knöpfel | last post by:
Hello On our asp.net 2.0 website we impersonate every request to the identity of the user logged in. This works this way: 1. user logs in, providing username, password 2. user is authenticated against an active directory and the windows identity is retrieved (and stored in the session!!) 3. user is impersonated using the windows identity (thread is now running under the identity of the user)
0
1111
JustRun
by: JustRun | last post by:
Hi , I use .NET 2.xx for developing an intranet site, The IIS (my application) on Server1 (Domain controller) the SQl server 2000 on Server2. and both servers running through windows 2003. I did the following steps, 1- Create Domain account on the Domain controller (Server1\ASPNET) 2- Made new login on the SQL, and created new user on the database I want to access, then I gave that user permissions to access my stored procedure and...
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.