473,249 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,249 software developers and data experts.

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 3756
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
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
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
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
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
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
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
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
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
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
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.