Click here to Skip to main content
15,886,562 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Problem Description:

I have Windows application called appTest (environment: Windows 8.1; Visual Studio 2010; C#).
This application is connected to SQL Server 2008 located in the same domain as my machine, and it runs successfully. In app.config file connection string looks like that:
<add name="strConn" connectionString="Data Source=mccsql1;Initial Catalog=dbTest;Persist Security Info=True;User ID=sa;Password=pwd1" providerName="System.Data.SqlClient" />


Now I changed connection string like that:
<add name="strConnTest" connectionString="Data Source=Domain2ServerName;Initial Catalog=dbTest;Integrated Security=true;" providerName="System.Data.SqlClient" />

I used that type of connection string because client setup my credentials with Windows Authentication.

Then I created setup project and moved appTest.exe and appTest.msi files into the Server2 located in client domain (environment: Windows Server 2012; SQL Server 2012).

Again application appTest runs successfully (both – application and SQL Server again in the same domain Domain2).

Question:
Now I have a request to run my application (Domain1) with client’s SQL Server 2012 (Domain2) using VPN.

I opened client’s VPN (using Cisco AnyConnect), and then ran my application with strConnTest. I got the error:
“Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.”

How to fix this problem?

Thanks,
Posted

1 solution

If the server is in one AD domain and your user account is in another, but default, there is no trust relationship between the two domains. Your login will not work.

To fix this you either need to setup a trust relationship between the domains to that the SQL Server's domain trusts the one your user account is in or you need to create and use an account that's in the same domain as the SQL Server.

There is nothing you can do in the connection string or your code to fix this.
 
Share this answer
 
v2
Comments
open_door8 14-Aug-15 14:26pm    
Good explanation - thank you, Dave

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900