Clearing Remote Share File sessions

All
Hopefully someone can help me. I am working with some pretty archaic software Fox Pro 2.6 to be exact. I am trying to extend the functionality of this program using the .net Framework. Unfortunately the program that I am trying to write needs to have exclusive access to the .DBF files in Fox Pro. Users access the files via a remote server where the DBF's are stoed in a Free Table Directory. When a user access one of the tables in the program it creates a shared File session on the remote computer. In order to run the program I have to make sure that all file sessions are cleared or the program will not execute. Is there a .net Framework Class that will allow me to clear the open file sessions programmatically. I looked into writing a batch script that uses "net session" but this will not work for my situation.
Please Help!!!!!!
[854 byte] By [Jharris65] at [2007-12-17]
# 1

To close a file server session you need to call the NetSessionDel function. Note that this will close a particular session and will result in any open files, pipes, or other resources being forced closed. The sessions that NetSessionDel acts on are those displayed when running the “net session” command.

From the client side, if you’re experiencing problems with different credentials conflicting when attempting to connect to a file server in order to create a file server session, then you can use the NetUseDel function to delete any use records that are persisted. The use records that NetUseDel acts on are those displayed when running the “net use” command.

Both of these functions can be used from managed code using either C++ Interop or P/Invoke from C# et al.
Cheers,

Kenny Kerr
Microsoft MVP

http://weblogs.asp.net/kennykerr/

KennyKerr at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Thanks Kenny I will give it a try....
Jharris65 at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified