Solved

Display list of all pages in a Virtual Directory C#

Posted on 2011-02-25
4
319 Views
Last Modified: 2012-08-14
I'm looking for a way to populate a listbox with all the pages found in a vitual directory.

The UI will have an entry for the user to enter the path (e.g. http://servername.domain.com/path), I then need to get ll pages and sub folders within tis directory.

Does anyone know if this is possible?

Thanks
0
Comment
Question by:wint100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:MikeQc
ID: 34986090
That is relatively simple.
Use Server.MapPath("http://servername.domain.com/path").
This will return the physical path on the server.
From that you could do a search for all the .aspx, .html of the path and populate your listbox.
0
 
LVL 1

Author Comment

by:wint100
ID: 34986096
From that you could do a search for all the .aspx, .html of the path and populate your listbox.

What search parameters should I use? Do you have any example code?
0
 
LVL 6

Accepted Solution

by:
MikeQc earned 500 total points
ID: 34986102
System.IO.Directory.GetFiles(physicalPath, "*.html")
System.IO.Directory.GetFiles(physicalPath, "*.aspx")
0
 
LVL 1

Author Comment

by:wint100
ID: 34986255
This doesn't seem to work in silverlight, I'll have to try a similar approach that is silverlight friendly.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question