Solved

Display list of all pages in a Virtual Directory C#

Posted on 2011-02-25
4
318 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.

730 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