473,499 Members | 1,926 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\Network Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService.) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Network 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="LocalSqlServer"/>

<add name="LocalSqlServer" connectionString="Data Source=Jupiter;Initial
Catalog=aspnetdb;Integrated Security=true"
providerName="System.Data.SqlClient"/>

<add name="SMS_ConnString" connectionString="Data Source=Jupiter;Initial
Catalog=SMS;Integrated Security=true" providerName="System.Data.SqlClient"/>

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 3775
On Aug 29, 9:54*pm, "Brett" <bret...@newsgroup.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\Network Service". *Anonymous authentication is enabled and uses
the application pool identity (NetworkService.) *Impersonation is enabled
and uses the authenticated user's identity. *NT Authority\Network 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\Network 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...@newsgroup.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\Network Service". *Anonymous authentication is enabled and uses
the application pool identity (NetworkService.) *Impersonation is enabled
and uses the authenticated user's identity. *NT Authority\Network 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\AspNetServer
$, 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\AspNetServer$ 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****@microsoft.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*****@newsgroup.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\Network Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService.) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Network 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="LocalSqlServer"/>

<add name="LocalSqlServer" connectionString="Data Source=Jupiter;Initial
Catalog=aspnetdb;Integrated Security=true"
providerName="System.Data.SqlClient"/>

<add name="SMS_ConnString" connectionString="Data Source=Jupiter;Initial
Catalog=SMS;Integrated Security=true"
providerName="System.Data.SqlClient"/>
>
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**********************************@l42g2000 hsc.googlegroups.com...
On Aug 29, 11:01 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Aug 29, 9:54 pm, "Brett" <bret...@newsgroup.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\Network Service". Anonymous authentication is enabled and uses
the application pool identity (NetworkService.) Impersonation is enabled
and uses the authenticated user's identity. NT Authority\Network 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\AspNetServer
$, 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\AspNetServer$ 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
14612
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...
0
1565
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...
1
2598
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...
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...
3
1959
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...
0
1196
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...
6
12756
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...
0
1506
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...
0
1101
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...
0
7134
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,...
0
7012
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...
1
6901
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...
0
7392
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...
0
5479
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,...
0
4605
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...
0
1429
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 ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
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...

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.