title: How to fix System.Data.SqlClient.SqlException: Login failed for user
body: <p>When I run it I get this:</p>
  
  <p><a href="https://i.stack.imgur.com/6OFtN.png" rel="nofollow noreferrer">Error Screenshot</a></p>
  
  <p>I enabled Windows authentication in IIS, SQL Server, and also added the authentication method in web.config:</p>
  
  <pre><code>&lt;system.web&gt;
    &lt;authentication mode="Windows"/&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>(I am literally out of ideas...)</p>
  
  <p>As you may see, the DataConnection is running:</p>
  
  <p><a href="https://i.stack.imgur.com/g94Py.png" rel="nofollow noreferrer">DataConnection Screenshot</a></p>
  
  <p>The connection string from <code>web.config</code>:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;clear/&gt;
      &lt;add name="cafeaconnection" 
           connectionString="Data source=LENOVO-PC\SQLEXPRESS; Initial catalog=tipuridecafeaDB; user id=user; password=password; persist security info=True;" 
           providerName="System.Data.SqlClient" /&gt;
      &lt;add name="ConnectionString" 
           connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\tipuridecafeaDB.mdf;Integrated Security=True" 
           providerName="System.Data.SqlClient"/&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>[SqlException (0x80131904): Login failed for user <strong>'Shade'</strong>.]</p>
    
    <p>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) +907<br>
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +334<br>
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38<br>
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +699<br>
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89<br>
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection) +426<br>
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource<code>1 retry, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection) +78<br>
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource</code>1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection) +191<br>
    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource<code>1 retry, DbConnectionOptions userOptions) +154<br>
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource</code>1 retry, DbConnectionOptions userOptions) +21<br>
    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource<code>1 retry) +90<br>
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource</code>1 retry) +443<br>
    System.Data.SqlClient.SqlConnection.Open() +96<br>
    YourCoffeeShop.App_Code.ConnectionClass.GetCafeaByType(String cafeaType) in D:\YCS\YourCoffeeShop\YourCoffeeShop\App_Code\ConnectionClass.cs:29<br>
    YourCoffeeShop.Pages.Cafea.FillPage() in D:\YCS\YourCoffeeShop\YourCoffeeShop\Pages\Cafea.aspx.cs:26<br>
    YourCoffeeShop.Pages.Cafea.Page_Load(Object sender, EventArgs e) in D:\YCS\YourCoffeeShop\YourCoffeeShop\Pages\Cafea.aspx.cs:17<br>
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51<br>
    System.Web.UI.Control.OnLoad(EventArgs e) +95<br>
    System.Web.UI.Control.LoadRecursive() +59<br>
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678  </p>
  </blockquote>