-2

I have shared folder on ubuntu/samba server of my network.

I am running my c# code on Vista , so How can i read file shared on ubuntu/samba server ?

My code :

String errorLogFile = @"\\\\198.168.0.2\\sharedfolder\myfile.wmv";

//throws excetion login fail
StreamReader sr = new StreamReader(errorLogFile);

sr.Read();

streamWriter.Close();
Pranay Rana
  • 175,020
  • 35
  • 237
  • 263

2 Answers2

2

If the share is configured properly you should be able to access it via \\ubuntumachine\sambasharename just as you would a Windows share.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
Tom Studee
  • 10,316
  • 4
  • 38
  • 42
2

Use the code provided in this answer to authenticate your code for the remote directory.

Update:
Additionally, the combination of escaped backslashes and verbatim strings is a bad idea. Use one of these but not both.
Also, you are missing the backslash after the name of the shared folder.
It should be like this:

String errorLogFile = @"\\198.168.0.2\sharedfolder\" + finaldate + ".wmv";
Community
  • 1
  • 1
Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443