且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.NET Web应用程序中浏览目录(文件夹而不是单个文件)

更新时间:2022-11-04 19:41:08

检查此博客
ASP.Net 2.0中的目录浏览 [ ^ ]
--NDK
check this blog
Directory Browsing in ASP.Net 2.0[^]
--NDK


<%@ Import Namespace="System.IO" %>
<html>
<body>
    <% foreach (var dir in new DirectoryInfo("E:\\TEMP").GetDirectories()) { %>
        Directory: <%= dir.Name %><br />

        <% foreach (var file in dir.GetFiles()) { %>
            <%= file.Name %><br />
        <% } %>
        <br />
    <% } %>
</body>
</html>



从这里提取:
http://***.com/questions/6047228/listing-folders-in-a-directory-using-asp-net-and-c-sharp [ http://www.dotnetperls.com/mappath [



extracted from here :
http://***.com/questions/6047228/listing-folders-in-a-directory-using-asp-net-and-c-sharp[^]

Also you may add MapPath to that code :
http://www.dotnetperls.com/mappath[^]

Hope it helps.