I have a .NET windows application I am writing in which I want to run "explorer.exe" to open a file. Basically, I have this program that shows users files (in a grid) that is in a folder on the network in which they do not have access to. So basically I want them to be able to view certain files (like Doc(x), PDF, JPG, etc). When they click on the file in the grid, I want it to launch the appropriate application for the extension of the selected file. When using this as myself it was working using:
Process.Start("explorer.exe", @"\\myserver\folder\test.pdf");
However, these files are in a location that the actual users do not have access to. I tried wrapping it with the following:
using (new Impersonator("username", "domain", "password"))
{
}
But I got error:
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll
Additional information: Unknown error (0xfffffffe)
I even tried using ProcessStartInfo and setting username, password and domain there but kept getting:
The directory name is invalid.
So any ideas on how to launch a file (i.e. Doc(x), PDF, JPG, etc.) with giving it credentials of a user that has access to that folder on the network?
User contributions licensed under CC BY-SA 3.0