question

Donald-0878 avatar image
0 Votes"
Donald-0878 asked Yufeishao-msft edited

Login failure

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("@Name", 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, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +118
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +268
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +315
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 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-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yufeishao-msft avatar image
0 Votes"
Yufeishao-msft answered Yufeishao-msft edited

Hi @Donald-0878,

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.






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered Donald-0878 edited

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.
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This happened when I changed my connection string to this:

SqlConnection con = new SqlConnection("Data Source=N1NWPLSK12SQL-v02.shr.prod.ams1.secureserver.net;Initial Catalog=Quirver_DB;Trusted_Connection=True);

But when it was like this:

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.

0 Votes 0 ·
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.