开发者

How to open a file stored in a server from aspx page using UNC share path?

I am listing the files stored in a remote server in the aspx page grid view with the file name linked (href) to the UNC path of the f开发者_如何转开发ile.

when the user clicks the file name link, it should open the file from the server to allow the user read the file.

I am using impersonation (Using mirror logon method) for file upload and delete in the same page which works fine.

When I try to click the link to view the file it throws an error message box saying access denied.

While upoading / deleting file from my application, it uses the impersonated account I specified in web.config.

But it uses default ASP.NET (SERVER\IUSR_SERVER) account when trying to access via the link. I cant give read access to all in my file server share.

How can I make the application use the impersonated account while trying to access the file for reading through the link I am showing for the files?

Or please suggest me an better alternative to do the same.

Thanks In advance.


When you generate the links in the Web page, do not point directly to the UNC, but to a page of your app, with a parameter to identify the file. In this page, use the same impersonation method to open the file and send its content back to the Web browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜