Open File on Network As A Different User

0

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?

c#
asked on Stack Overflow Jul 3, 2014 by user3495483 • edited Jul 3, 2014 by Sam

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0