Wednesday, March 21, 2012

Login failed for user

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Source Error:

Line 15: Dim cmd As New SqlCommand
Line 16: con6 = New SqlConnection("Server=localhost;UID=sa;PWD=XXXX;Database=knowledge;integrated security=sspi")
Line 17: con6.Open()
Line 18: cmd.CommandText = "select Status from usr where Uid='" & txtUsername.Text & "' and Pass='" & txtPassword.Text & "'"
Line 19: cmd.Connection = con6


Source File:D:\Visual Studio 2005\Projects\WebApplication11\WebApplication11\login.aspx.vb Line:17

When I try the same code at my home computer it gives the same error as

Login failed for user 'BLACK-HULK\ASPNET'.

I am using XP at home and Server 2003 at the other computer, while debugging the application seems to be working fine dunno wat goes wrong while running it directly



I am not 100% sure, but when you use Integrated Security, the connection looks into windows and see who is logged on (basically). Thats why it says: LOGIN FAILED FOR USER 'BLACK-HULK\ASPNET.

As I see it, it gives no meaning of adding UID and PWD when you use Integrated Security.

Can you try removing Integratied security from you connectionstring.

|||

I would highly recommend against accessing your database with sa as a login. Also, as suggested before, using integrated security, kind of defeats the purpose of putting in a username and password ;)

HTH.

Peter

No comments:

Post a Comment