Solved

Display list of all pages in a Virtual Directory C#

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS redirect 1 65
Hey!! 5 33
Help with adding DLL file in Windows project 20 27
Call Controller Action Method from ASPX 2 12
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

816 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now