Login failure

Donald Symmons 2,996 Reputation points
2022-05-13T09:48:11.46+00:00

I have posted many questions regarding this and don't seem to get it right. However, there is a twist to this. I think I succeeded in granting permission to the user 'quirverT', because when I tried to create a new account on my website, the error changed to this:

Server Error in '/' Application.
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
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. The login is from an untrusted domain and cannot be used with Windows authentication.

Source Error:

Line 41: cmd.Parameters.AddWithValue("@DeezNutz ", txtname.Text);
Line 42: cmd.Connection = con;
Line 43: con.Open();
Line 44: dr = cmd.ExecuteReader();
Line 45: }

Source File: g:\PleskVhosts\quirver.com\httpdocs\SignUp.aspx.cs Line: 43

Stack Trace:

[SqlException (0x80131904): Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) +1524
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +467
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +70
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +940
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +111
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1567
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +118 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +268
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +315 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) +128
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +265
System.Data.SqlClient.SqlConnection.Open() +133
SignUp.Button1_Click(Object sender, EventArgs e) in g:\PleskVhosts\quirver.com\httpdocs\SignUp.aspx.cs:43
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11596288
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +274
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1890

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

3 answers

Sort by: Oldest
  1. Olaf Helper 47,631 Reputation points
    2022-05-13T13:01:02.353+00:00

    The login is from an untrusted domain and cannot be used with Windows authentication.

    This logon error happens in a Windows Workgroup (= no domain) when you try to logon to a remote SQL Server using Windows Authentication; that don't work in a Workgroup, only in a AD.
    Use SQL Authentication instead.

    Was this answer helpful?


  2. Erland Sommarskog 137.7K Reputation points MVP Volunteer Moderator
    2022-05-13T20:53:33.943+00:00

    By default, SQL Server only accepts Windows authentication. To be able to use SQL authentication, right-click the server in Object Explorer and select Properties. Go to the Security page to enable SQL Server authentication. You need to restart SQL Server for the change to take effect.

    Was this answer helpful?

    0 comments No comments

  3. YufeiShao-msft 6,931 Reputation points
    2022-05-16T06:32:50.823+00:00

    Hi @Donald Symmons ,

    Please try to use the SQL Authentication to login to the SQL Server, make the account trusted in SQL Server

    And for

    SqlConnection ="Data Source=N1NWPLSK12SQL-v02.shr.prod.ams1.secureserver.net;Initial Catalog=Quirver_DB;User ID=quirverT;Password=***");

    Then the error of Login failure for user 'quirverT' comes along.

    Consider putting your connection string inside of the web.config file and check the login credentials
    Can you open SSMS with this account?
    Make sure this account mapping to the DB you would like to reach, and ensure that the settings are set to grant for performission to connect to the DB and enable for the login
    https://stackoverflow.com/questions/37297944/server-error-in-application-login-failed-for-user

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.