I have VSTO application that needs to access a SQL server database but it cannot do it directly. I have thought of two ways to perform this task, but I don’t know if those are the best ones :
- Creating a “fake” aspx that will be accessed from the VSTO and that will call the SQL server database
- Hosting a web service on my distant server. This web service will be accessed from the VSTO and will call the SQL server database
Your second option is the way to go. Create a WCF service, and have this access the SQL Server in a trusted environment. You can protect the service with Windows Authentication, or otherwise pass a user name/password or session key with every call.