Showing posts with label How to read remote computer file. Show all posts
Showing posts with label How to read remote computer file. Show all posts

Monday, May 28, 2012

How to Read Remote PC file and Show in your PC window

Sometimes you may need to read a file which exists in Server PC and want to show in your Client PC. To make it simple Lets say i want to read an Excel file which exists in a remote machine and want to show in my client machine.

By following code we can do that easily.

FileInfo finfo = new FileInfo(@"\\192.168.100.20\D$\Leave information.xls");
bool exists = finfo.Exists;
 

if (finfo.Exists)
{
          System.Diagnostics.Process.Start(
finfo.FullName);
}

else
{
         MessageBox.Show("File Not Found");
}

// Here my remote PC address is 192.168.100.20 and The Excel file located in D drive 

You may place the above code into any button click event