SQL Connection problem

A

Arda

Hi all,
I tried to connect a database(SQL) by both VS 2003 interface tools and
normal typing.

When I make the connection in subdirectory project it doesn't work and gives
an
error like this;

Server Error in '/WebApplication1' Application.
----------------------------------------------------
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Nevertheless, when I use the same .aspx page in normal web site (without any
sub directory) it works without any error.

I have been using Windows 2000 and it was both working but when I installed
Windows 2003 Enterprise Edition, it started to give that error(below). So,
most probably this error acquires because of Windows 2003 settings is there
anyone who knows how to solve this problem?

Kind Regards,
Arda Coskun
 
C

Carl Prothman [MVP]

Arda,
By default, the ASP.NET worker process on a Windows Server 2003 (IIS6)
machine uses the local "NT AUTHORITY\NETWORK SERVICE" user
account. And on Windows 2000 / XP (IIS 5.x), it uses the local ASPNET .
user account. Also, ASP.NET has impersonnation turned off by default.

Hence, in this configuration, if you want your web page to access a Sql Server
database, you'll need to give database access permissions to the corresponding
local user account, depending on which IIS version you are using.

Here is a summary for a machine called "CARLP7" on IIS 5.x,
with Authentication mode="Windows" in web.config

- If Identity impersonate="false" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\ASPNET

- If Identity impersonate="false" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\ASPNET

- If Identity impersonate="true" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\IUSR_CARLP7

- If Identity impersonate="true" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\Administrator (logged on user)


Here is a summary for a machine called "CARLP7" on IIS 6.0,
with Authentication mode="Windows" in web.config

- If Identity impersonate="false" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = NT AUTHORITY\NETWORK SERVICE

- If Identity impersonate="false" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = NT AUTHORITY\NETWORK SERVICE

- If Identity impersonate="true" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\IUSR_CARLP7

- If Identity impersonate="true" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\Administrator (logged on user)

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top