I have a C# console application that needs to read a shared file on a machine in another domain. When the application tries to access the file an exception occurs as the loc
a) p/invoke LogonUser with LOGON32_LOGON_NEW_CREDENTIALS
and create a new WindowsIdentity with the new token, then use normal file access.
b) p/invoke WNetAddConnection3. Be advised that this makes your remote share accessible to every other process on your machine.
c) WMI via System.Management
and CIM_DataFile; you won't even need p/invoke. System.Management
lets you specify credentials for remote machine.