简体   繁体   中英

Access folder on Web Server using C#

I am trying to find ways, by which a user can open a folder on web-server on button click in a web application, based on windows authentication and no impersonation.

Two methods, that i have came across are :

  • Using href link, it works, but only in IE.

    <a href="\\\\test\\c$\\xyz">Open</a> "

  • Using C#, It doesn't seem to work, i gave permissions to Application Pool and Users to access the folder, but was getting access denied.

    System.Diagnostics.Process.Start(@"\\\\test\\c$\\xyz");

Starting with "accessing to administrative shares isn't a good idea", if your users attempts to access to it as normal user (ie probably not logged/verified by a domain controller) will surely fails.

Assuming you want to access to a granted share you should link using file: as URI scheme.

Local folder:

<a href="file:///D:/Downloads/">click me</a>

Remote folder:

<a href="file://///test/sharedfolder/">click me</a>

here works both with IE and FF.

Read this: http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx

Taken from: How to open a windows folder when clicking on some link on a HTML page using Python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM