Help with network access...

I was wondering if anyone could help me with accessing network resources and running a exe using a C# program.  What I am trying to do is have my program access a server and run an exe, which exists on the server, on the client.  I need help with access the server and running the exe.  If anyone could help on this it would be great.



Answer this question

Help with network access...

  • DAN TRUNG

    Is the server accessible by a network share Or is it a web server somewhere

    Either way, once you have the path to the exe (either on the share, or downloaded to the local machine), use the Process class to run it:



    using System.Diagnostics;

    Process process = new Process(@"\\servername\share\filename.exe");
    process.Start();

     



    To download a file from a webserver, use the WebClient class:



    using System.Net;

    Uri uri = new Uri("http://www.foo.com/bar.exe");
    WebClient client = new WebClient();
    client.DownloadFile(uri, "C:\...\bar.exe");

     


  • Help with network access...