Reputation: 105
In web.config of my ASP.NET project, the Windows Authentication Mode (of SQL Server) is enabled ( i.e.
<authentication mode="Windows"></authentication>
). But each time when I built the project and launched it in my browser, an error appeared saying that:
"Server Error in '/' Application Login failed for user 'DOMAIN\MS-AUTO1$'.".
In the yellow page, the exception says "Exception Details:
System.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\MS-AUTO1$'."
My account shall be DOMAIN\MyAccount but not DOMAIN\MS-AUTO1$.
How do I need to modify the web.config file so that it uses DOMAIN\MyAccount to do authentication but not DOMAIN\MS-AUTO1$ ?
PS: In Microsoft SQL Server 2012 Management Studio I use "MS-AUTO1" as the server name and Windows Authentication as the Authentication method. The Server type is Data Engine. And that works.
Is it a reason that MS-AUTO1$ was used as my Windows username?
Thanks
Upvotes: 0
Views: 2243
Reputation: 362
Windows authentication in ASP.Net application is different that Windows Authentication for SQL Server connection. You must specified in your connectionString that you want to use Integrated Security.
See here the samples of different connection authentication types : https://www.connectionstrings.com/sql-server-2012/
Upvotes: 1