views:

47

answers:

1

How can I secure the communication between a C# programm running locally on my computer and a SQL Server in a hosted environment?

I have an asp.net application that is secured by SSL encryption. So using the asp.net from an open wlan connection is no problem.

How can I achieve the same kind of encryption for my administrative tool? Would it be best to write a service? But how would that connection to the service be secured?

+1  A: 

You should be able to simply specify encryption in the connection string like so:

Provider=SQLNCLI10.1;Integrated Security=SSPI;Persist Security Info=False
;Initial Catalog="Foo";Data Source=(local);Use Encryption for Data=True;

This connection string uses the Native Client and a trusted connection but obviously can be adjusted for a SQL username and password.

For more, see the "Enable encryption for a specific client" section of this KB article. You have to ensure that the client has the server's certificate in its Trusted Root Certification Authorities folder. Here is another article.

Thomas