Login failure

Donald Symmons 2,856 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
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,756 questions
0 comments No comments
{count} votes

Accepted answer
  1. YufeiShao-msft 7,056 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.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Olaf Helper 40,901 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.


  2. Erland Sommarskog 101.4K Reputation points MVP
    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.

    0 comments No comments