Listing Folders in a Directory using asp.net and C#

后端 未结 5 1998
你的背包
你的背包 2020-12-11 07:58

.aspx file:

<%@ Import Namespace=\"System.IO\" %>




        
5条回答
  •  没有蜡笔的小新
    2020-12-11 08:58

    Response.Write in a static codebehind method: DIRTY! In addition you did't control the position where you write. This a little bit cleaner...

    // YourPage.aspx
    <%@ Import Namespace="System.IO" %>
    
    
        
      <% foreach(var file in Directory.GetFiles("C:\\Temp", "*.*", SearchOption.AllDirectories)) { %>
    • <%= file %>
    • <% } %>

提交回复
热议问题