想要获取* .aspx完整目录 [英] want to get *.aspx full directory

查看:113
本文介绍了想要获取* .aspx完整目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

在Windows窗体应用程序中,我可以通过"Path.Combine(Application.StartupPath,"xxx.xxx")获得可执行文件的路径.我想知道是否要获取aspx文件的路径,是否可以调用任何API?

谢谢.

Dear all

In windows form application I can get an executable file''s path by "Path.Combine(Application.StartupPath, "xxx.xxx")". I wonder if I want to get a aspx file''s path, is there any API I can call?

Thank you.

推荐答案

此代码正在运行,请检查一次

This code is working check it once

 DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(""));

FileInfo[] str = dirInfo.GetFiles("*.aspx");


请在这里找到解决方案....

Hi Please find the solution here....

<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)
    Dim dirInfo as New DirectoryInfo(Server.MapPath(""))

    articleList.DataSource = dirInfo.GetFiles("*.aspx")
    articleList.DataBind()
  End Sub
</script>


<asp:DataGrid runat="server" id="articleList" Font-Name="Verdana"

    AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee"

    HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"

    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" />
    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time"

        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
    <asp:BoundColumn DataField="Length" HeaderText="File Size"

        ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,### bytes}" />
  </Columns>
</asp:DataGrid>



谢谢
Murugan



Thanks
Murugan


这篇关于想要获取* .aspx完整目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆