|
-
Jan 10th, 2019, 01:57 PM
#1
Thread Starter
Lively Member
Login failed.The login is from an untrusted domain and cannot be used..
Hello..
I have created a login form for my project,I have searched on google and found out to make the integrated security=false but it still doesnt work,and when i install it on another pc it shows me the error :
Code:
XCEPTION : Handled
MESSAGE : Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
SOURCE : .Net SqlClient Data Provider
TARGETSITE : Void .ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData, System.Data.ProviderBase.DbConnectionPool, System.String, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager)
STACKTRACE :
at 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)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at DG.DentneD.LoginForm.button1_Click(Object sender, EventArgs e) in C:\Users\windows\Desktop\New folder (19)\dentned-master\DentneD\LoginForm.cs:line 56
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
and here is my LoginForm code
Code:
doctors.last_login = DateTime.Now;
string srcConnString = null;
var csBuilder = new SqlConnectionStringBuilder(srcConnString);
csBuilder.Remove("Integrated Security");
csBuilder.UserID = "sa";
csBuilder.Password = "sasa";
var connString = csBuilder.ToString();
SqlConnection sqlcon = new SqlConnection("data source=DESKTOP-Q8526KR;initial catalog=dentned;integrated security=True;user=sa;password=sasa;MultipleActiveResultSets=True;App=EntityFramework"");
string query = "Select * from dbo.doctors Where doctors_username = '" + txtUsername.Text.Trim() + "' and doctors_password = '" + txtPassword.Text.Trim() + "'";
SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon);
DataTable dbdoc = new DataTable();
//sda.Fill(dbdoc);
if (dbdoc.Rows.Count == 1)
{
FormMain objfrmMain = new FormMain();
this.Hide();
if(dbdoc.Rows[0][8].ToString()!="admin")
{
objfrmMain.MainMenuStrip.Items[0].Visible = false;
objfrmMain.MainMenuStrip.Items[2].Visible = false;
objfrmMain.MainMenuStrip.Items[3].Visible = false;
objfrmMain.MainMenuStrip.Items[4].Visible = false;
objfrmMain.MainMenuStrip.Items[5].Visible = false;
objfrmMain.MainMenuStrip.Items[8].Visible = false;
}
objfrmMain.Show();
}
else
{
MessageBox.Show("Username-i ose passwordi eshte gabim !!!!!!!!!!!!!!!!!!!");
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|