[Mono-dev] accessing file on a windows share

Buderya Roshan broshan at novell.com
Thu Nov 17 01:56:41 EST 2005


>>> Buderya Roshan 11/17/05 12:25 PM >>>
> "Buderya Roshan" <broshan at novell.com> 11/16/05 5:07 PM >>>
> Hi,
> 
> I am trying to access a file on a remote share (Windows share with
full
> access to everyone). On windows using .net I can access and read the
> file as

> StreamReader sr = new
> StreamReader(@"\\server_name\share_name\file_name");
> string line = sr.ReadLine();

> But when I compile & run the same under mono for windows, I get
> System.IO.DirectoryNotFoundException.  How do I specify the filepath
in
> mono? Also when this is running from Linux (Samba client setup) do I
> need to do something else?

Answering my own question, using mono on Linux, I figured (with some
help from the mono IRC channel) we need to use Gnome.Vfs library to
access remote shares. A URI of the form
smb://user:password@hostname/path_to_file/ should work.

Thanks,
Roshan



More information about the Mono-devel-list mailing list