[Mono-osx] How to logon to Win or Mac using credentials through code?

Dan VanderMolen dan.vandermolen at figpsoft.com
Fri Jan 23 10:07:06 EST 2009

I would love to see an example of using socket server.
And an example / link of how to do impersonate to get remote network files
in a more managed .NET way.  Like maybe using the NetworkCredential object
for network files???

I tried using smb, but it does not seem to work?
It does work if I use the Mac's Go | Connect to Server menu method however.

I tried both of these path's unsuccessfully:
sPath = "smb:// File Depot";
sPath = "smb://user:pass@ File Depot";

dir = Directory.GetFiles(sPath, "*");

The error I receive is:
System.IO.DirectoryNotFoundException: Directory 'smb:/
File Depot' not found.   

In all cases it drops the first path delim like so: "smb:/"...
So I tried "smb:////..." but with same error message.

-----Original Message-----
From: mono-osx-bounces at lists.ximian.com
[mailto:mono-osx-bounces at lists.ximian.com] On Behalf Of Matt Emson
Sent: January 22, 2009 11:26
Cc: mono-osx at lists.ximian.com
Subject: Re: [Mono-osx] How to logon to Win or Mac using credentials through

d_v wrote:
> I should be more specific, besides I have not heard any ideas yet :)
> When I say "logon" I really mean that I am trying to copy a file over the
> network and I would like to supply the username and password and 
> (domain). At this point I don't even know if a Mac requires a domain 
> name...
> If you can point me in the right direction I would be grateful. even a
> link/bone :)
Doesn't look like there's a lot of a chance that'll work as it just a 
load of P/Invokes to a Windows specific library. Does Wine implement the 
library? Otherwise, what, exactly, are you trying to do? Copy a file 
across a network using a specific protocol? Copy between Windows/SAMBA 
shares? I would put forward that using Sockets would be simpler. Also, 
using Remoting and file streams is possible, though security is still an 
issue (but not tied to Win32 platform specific DLL's). A Mac does not 
have a "domain" in the Windows sense of the word, at best it'll have 
some kind of Windows domain emulation (or workgroup) via the SMB/CIFS 
protocols implemented within it (hint, just as you can do 
smb://myserver, cifs://myserver works too - not sure if they use the 
same subsystem, but it works much the same in Leopard.) A "lowest common 
denominator", such as a socket server, would work more successfully IMO.

Mono-osx mailing list
Mono-osx at lists.ximian.com

More information about the Mono-osx mailing list