?
Solved

Display list of all pages in a Virtual Directory C#

Posted on 2011-02-25
4
Medium Priority
?
324 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 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