Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5928819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:20:17+00:00 2026-05-22T14:20:17+00:00

//aspx.cs file using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

  • 0
//aspx.cs file


  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.IO;

  public partial class trash : System.Web.UI.Page
  {
protected void Page_Load(object sender, EventArgs e)
{
    Response.Write("<table style='width: 10px; height: 10px; margin-left:100px'>");

    foreach(var directory in new DirectoryInfo("C:\\Users\\naresh\\Documents\\Visual  Studio 2010\\WebSites\\CMANAGER").GetDirectories())
    { 

 Response.Write( "<tr>");      
    Response.Write("<td><a href= view4.aspx?folder="+ directory.Name + "> "+ directory.Name +"</a></td>");

 Response.Write("</tr>");
        }
    Response.Write("</table>");
}

}

With this code I’m listing all directories in the given directory with hyperlinks.So,If I click on the hyperlink now I should list all the files in the Particular directory in a separate page.But I’m having problem in giving Dynamic path based on the hyperlink clicked.
Please help me in this regard.
Thank you..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:20:17+00:00Added an answer on May 22, 2026 at 2:20 pm

    I think you want to use directory.FullName for the hyperlink. You many need to url encode it and then decode it on the new page when you read it off the query string.

    On view4.aspx after reading the folder off the query string, create a directory info object again and iterate over the results of directory.GetFiles()

    Here is a link to the DirectoryInfo class for more information
    http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page, Default.aspx, with its own code-behind file like this: using System;
I am downloading a file from the server/database via aspx page. When using the
I have a page base class that has no .aspx file and so I
I have an .aspx file that outputs an image using the following methods: Server.MapPath(somefile.png)
(Warning - asp newbie) I have an aspx file with the tag <%@ Page
I have created a web custom control and used within an aspx page. I
I have the following in my web.config: <location path=RestrictedPage.aspx> <system.web> <authorization> <allow roles=Group1Admin, Group3Admin,
I want to create two partial classes for the single aspx file. I am
.aspx file: <%@ Import Namespace=System.IO %> <html xmlns=http://www.w3.org/1999/xhtml> <head id=Head1 runat=server> <title>Explorer</title> </head> <body>
While editing an aspx file I found both these opening tags used for seemingly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.