Open Document/file on client with impersonation
I have an ASP.NET/c# web application.
There is a link on the page that i want to be able to click, open that file from a share, enable the user to edit it and then save it back to the share.
The share directory is locked down and can only be accessed via a seperate account, hence the need for impersonation.
I have tried many ways to do this, but have only managed to open the document on the client. (they are not able to save it directly back to the share without a seperate upload function)
Essentially, i wou开发者_StackOverflow中文版ld like to start a process on the client with impersonation so they can click save and will save directly back to the share.
Thanks
Register your own protocol handler on the client machine by first asking them to install your software.
On your ASP.NET web app you'll give link to the file but protocol will be your own instead of http:// or file:// this way your application will be invoked instead of windows trying to open it directly. Your app can impersonate the specific user that has access, open the file in a program and when the program exits it can exit.
See the following:
- Registering an Application to a URL Protocol
- A small C# Class for impersonating a User
- Process.WaitForExit Method
精彩评论