Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

October 16, 2007

Few days back,I developed an ASP.NET website in .NET 2.0 with SQL Server 2005 as the back end.  Everything was working fine in the cassini (web server that comes with VS 2005).

After finishing the project, for the testing purpose I thought of publishing it in the real IIS in my local machine.

All went smoothly :) and I was able to view the website locally, but when was I trying to login into the website with the administrator username and password I got something like thisLogin failed for user ‘NT AUTHORITY\NETWORK SERVICE’”

For some reasons I couldn’t understand why this is happening…. But after a googling I found that, this is because of the connectionstring that I used in the web.config :)

If you have created the connectionstring, like below

<add name=”xxxxx” connectionString=”Datasource=servername;Integrated Security=SSPI;initial catalog=xxxx;”
providerName=”System.Data.SqlClient” />

ie you are trying to login into the SQL Server DB using the Integrated Secrity credentials which wrong :)

So you have to explicitly specifiy the user id and password in the connectionstring, like below,

<add name=”xxxx” connectionString=”Data Source=localhost;Initial Catalog=xxx;user id=[userid];password=[password];” providerName=”System.Data.SqlClient”/>

Hope this will solve your issue

Entry Filed under: ASP.NET, ASP.NET Tips. Tags: , .

10 Comments Add your own

  • 1. retrt  |  October 30, 2007 at 8:38 am

    how to solve Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

  • 2. Rajeesh  |  October 30, 2007 at 4:30 pm

    Change the connectionstring in web.config – explicitly specifiy the user id and password in the connectionstring as mentioned in the post above.

    If this doesn’t solve the issue please let me know :)

  • 3. Binu  |  November 22, 2007 at 9:12 am

    It’s really help me alot:). Expecting more from you
    Thanks,
    Binu

  • 4. Mr VISHAL  |  September 9, 2008 at 11:11 am

    It’s really nice …..keep it up……a very good programming concept and where user can stop your thinking is start…….THANKS

  • 5. Mr VISHAL  |  September 9, 2008 at 11:14 am

    It’s really nice …..keep it up……a very good programming concept and where user can stop your thinking is start…..
    i want to add row run time when user click on button but the problem is that i want to add row between tow rows…I have a invoice and that user add perticulars and for that perticular he has to write a DESCRIPTION and those description i want to show in row so how can i show the data in row or add a row between tow row or a perticular index……..
    Thanks in Advance

  • 6. Ahmad  |  October 6, 2008 at 9:43 pm

    Thank you,it worked. it was great. I had tried many solutions but I had got desperate. Thank you

  • 7. ali  |  November 12, 2008 at 7:29 pm

    When you have created virtual directory of your application created in .Net2.0 and application is not running.
    Even everything is fine in web.config, still it is giving error in web.config file.

    Error :- The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

    Solution is
    goto command prompt then navigate to directory

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

    Now run this command

    aspnet_regiis -ga “NT AUTHORITY\NETWORK SERVICE”

    Everything will wok fine.

  • 8. almny.com  |  November 24, 2008 at 7:16 am

    thanks man :)

  • 9. Nodar  |  December 15, 2008 at 9:27 am

    ali

    Thanks! ) Yours advice help to me

  • 10. sky  |  May 26, 2009 at 9:40 am

    thank’s to ali

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Top Posts

Top Clicks

Calendar

October 2007
M T W T F S S
« Aug   Jun »
1234567
891011121314
15161718192021
22232425262728
293031  

Tags

ASP.NET ASP.NET Tips WPF WPF Blog WPF Controls WPF thirdparty controls

a

Recent Posts

2

Fav links

Feeds

Blog Stats