Posts tagged ‘ASP.NET Tips’
Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’
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 this “Login 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