简体   繁体   中英

How to open folder from web page

I want to open folder from web page on clicking on a button.

protected void Button1_Click(object sender, EventArgs e)
{
    Response.Redirect("file://C://inetpub//wwwroot//myproject");
}

Please suggest me proper code in C# for open myproject folder.

This can be ONLY done in IE , no other browser has access to file system. You can assign the path to href of an anchor tag, and it should work.

<a href="file://LAP6//C$">Open</a>

也许此声明可以帮助您:

 System.Diagnostics.Process.Start(@"C:\");

If you're looking at adding functionality to your website so that a user can upload files to it then look at this project on MSDN . It'll show you how to do this with an example ASP.NET project.

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