Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

October 16, 2007 at 2:33 pm 14 comments

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: , .

The “Atlas” Control Toolkit helps you bring your websites to life! WPF Controls blog

14 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. Jean Carlo De Castro  |  March 21, 2012 at 8:43 pm

      this is not working 4 me

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

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

  • 5. 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

  • 6. 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

  • 7. 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

  • 8. 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


    Now run this command

    aspnet_regiis -ga “NT AUTHORITY\NETWORK SERVICE”

    Everything will wok fine.

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

    thanks man 🙂

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


    Thanks! ) Yours advice help to me

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

    thank’s to ali

  • 12. pc slow  |  May 6, 2013 at 11:14 am

    Do you have a spam problem on this blog; I also am a blogger, and I was wanting to know your situation; we have
    created some nice practices and we are looking to exchange techniques with other folks, why not shoot me an email if interested.

  • 13. Nona  |  May 31, 2014 at 9:55 pm

    Hi there, constantly i used to check weblog posts here in the early hours in the morning, for the reason that i love to gain knowledge of more and more.

  • 14. mbdterrell  |  October 26, 2016 at 10:39 pm

    This is the right web site for anybody who wants to find out about this topic. You understand a whole lot its almost tough to argue with you (not that I actually will need to…HaHa). You definitely put a brand new spin on a topic that has been written about for ages. Wonderful stuff, just excellent!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Top Clicks

  • None


October 2007
« Aug   Jun »

Recent Posts


Blog Stats

  • 93,560 hits

%d bloggers like this: