Click here to Skip to main content
15,351,370 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all

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

Thank you.
Updated 4-Oct-11 15:51pm

This code is working check it once

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

FileInfo[] str = dirInfo.GetFiles("*.aspx");
Roger Chao 5-Oct-11 4:46am
Thank you for your help.
P.Salini 5-Oct-11 5:40am
u r welcome.
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")
  End Sub

<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">
    <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}" />

Roger Chao 5-Oct-11 4:46am
Sorry I'm not a VB guy, by still thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900