Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON

G

Guest

Hi,
I'm having problems with good old error... Login failed for user 'NT
Authority\Anonymous logon'.

The default web page comes up fine, but when the user attempts to log in
(which checks stored usernames in the database etc) then the error occurs.

a) The Web server is on a seperate box to SQL Server.
b) I'm using forms authentication.
c) I've enabled anonymous access, setting it to the correct domain account,
and am not allowing IIS to control the password.
d) The specific domain account has been granted the correct permissions in
sql server

e) web.config file is basically as follows..

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms" />
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
<identity impersonate="true" />
<trace enabled="false" requestLimit="100" pageOutput="true"
traceMode="SortByTime" localOnly="true" />
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
<appSettings>
<add
key="DBConnectionString"
value="server=servername;database=mydb;Integrated Security=SSPI"/>
</appSettings>
</configuration>

It works fine from the web server.

If anyone has any ideas, this would be most appreciated.

Also (not sure if this will help me or not), how can I tell which user the
aspnet worker process is running under?

Many thanks.
 
J

Juan T. Llibre

Use this short file I wrote :

identity.aspx
-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
 
J

John

You can find the account that the web app is running under by looking in the
'Identity' tab of the relevant 'Application Pool' within IIS 6. Try
allowing this access to your SQL server
 
J

Juan T. Llibre

Second thoughts ( besides finding out the process account user ) :

re:
I've enabled anonymous access, setting it to the correct domain account,

Was that account NT Authority\Anonymous
.... or YourWebServerName\Anonymous ?

re:
The specific domain account has been granted
the correct permissions in sql server

Was that account NT Authority\Anonymous
.... or YourWebServerName\Anonymous ?

re:
<identity impersonate="true" />

Since you *are* impersonating, it's the account that ASP.NET
is using as impersonation the one which needs permissions
everywhere.

That means the local user permissions, the SQL Server, etc.
 
J

Juan T. Llibre

Background info on this whole process is at :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp

Make sure you read it...





Juan T. Llibre said:
Second thoughts ( besides finding out the process account user ) :

re:
I've enabled anonymous access, setting it to the correct domain account,

Was that account NT Authority\Anonymous
... or YourWebServerName\Anonymous ?

re:
The specific domain account has been granted
the correct permissions in sql server

Was that account NT Authority\Anonymous
... or YourWebServerName\Anonymous ?

re:
<identity impersonate="true" />

Since you *are* impersonating, it's the account that ASP.NET
is using as impersonation the one which needs permissions
everywhere.

That means the local user permissions, the SQL Server, etc.
 
Joined
Jun 29, 2007
Messages
2
Reaction score
0
Hi,
I got this problem while moving my ASP.NET2.0 application from one server to another. Banged my head and finally came through. In my case, the problem occurred because I used SQLDataSource control, which was using a connection string that was pointing to some other SQL server. However, there are other cases as well in which this problem can occur.


Buggy, here are some suggestions which you can try:

(1) Use SQL server profiler (on the box where your SQL server resides) to find out the user the ASP worker process is running under.

(2) Create a user login called "NT AUTHORITY\ANONYMOUS LOGON" for your particular database, and give this account read/write rights.

Hope this helps.
"When the going gets tough, just challenge yourself."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top