-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();
5
  • What have you tried? What is the problem/error? What is ubantu and sambha (rhetorical)? With 15k rep mostly from answers you should value a good question! Commented May 30, 2011 at 15:07
  • think you mean ubuntu and samba? Commented May 30, 2011 at 15:07
  • @ Daniel - yes its ubuntu and samba ... i tried to read file as we do on windows machine but it shows no file exists... Commented May 30, 2011 at 15:09
  • y -1 ? is anything wrong with question ? Commented May 30, 2011 at 15:15
  • @Daniel - okies anyway it resolve my issue ............ Commented May 30, 2011 at 15:37

2 Answers 2

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";
Sign up to request clarification or add additional context in comments.

Comments

2

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

3 Comments

i am doing it but its says "Login fail".. how to avoid it...is i have to use winows impersonation ??
So you are probably using the wrong login credentials. Verify those first before suspecting your code is incorrect.
@Cody Gray - if i use windows impersonation libaray will it work for unbuntu ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.