Accessing VFP Tables Across Network w/ .Net

I run into an interesting issue this week that I needed to resolve, and I have to admit it was fun and interesting.  We were developing a Web Service for a Third Party interface to FoxPro free tables.  Initially we were going to do this by developing a VFP Web Service, but we found out that the Soap Toolkit is being dropped by Microsoft, and that to make it work on the server we would need to enable something that we didn't want to enable to make it work.

Anyway, as I started writing the c# Web Service everything was going well, I was able to access the data that was local, and the Web Service was working perfect.  Then when I got ready to deeply it to the Development Test platform, things broke.  The reason they broke was that the VFP Tables were stored on a different server than where the Web Service was running, and ADO could not access the tables on the mapped drives from IIS.

Then as I got further into this, I was finally able to get my Web Service to Impersonate a user other than the IIS user, and that got me connected to the server, but then things failed when I tried doing a select on the data.  So back to doing research, and I finally found a website where someone had posted that he had paid Microsoft $200 to get the answer and he was waiting for a response back.  Someone made the comment that $200 is a lot of money to spend only to find out you have to add "BackgroundFetch=No" to the connect string for the tables.  I got a laugh out of that comment, but amazing it solved my problem right off!!!

So in a nutshell, the Web Service is working, and everyone is happy with what I finally accomplished!!!

No on to the details for making this work:

Impersonating a user from an ASP.NET c# program:
Here is a link to Microsoft's website where I found the code: support.microsoft.com/kb/306158 This turned out to work almost flawless for me.  I copied their code into my ASMX file, and changed the user name, domain and password and bang I was instantly impersonating the user I wanted.

Connect String I used to connect to the tables:
  string cConnectionString1 = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=\\\\UNCPath\\DiretoryPath\\;BackgroundFetch=No;Exclusive=No";

Comments:
If you don't know how to use this code you may want to spend a little time doing some reading, for now I don't have a lot of time to write an article on programming, but I will eventually get around to doing this.
«January»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910