Tuesday, March 27, 2012

List off all files in a website

Hi all
Is it possible to programatically list all the .aspx files within the
currenty running website.
e.g. something like
foreach {aspxfile in AllaspxFilesInMyProject)
{
string filename = aspxfile.title;
}
thanks
Andyno, its not that easy unfortunately.
You can list all the aspx pages using recursion quite easily if you have
access to the directory structure, open and read each as a text file and
pick out any title tags.
Alternatively, you could create a spider that requests pages and follows
links, assuming your site can be followed. Then you can pick out the
information you need. There are spider examples around, and recursione
examples.
Regards
John Timney
Microsoft MVP
"AAJ" <a.a.com> wrote in message
news:%23zXruVLgGHA.2208@.TK2MSFTNGP05.phx.gbl...
> Hi all
> Is it possible to programatically list all the .aspx files within the
> currenty running website.
> e.g. something like
> foreach {aspxfile in AllaspxFilesInMyProject)
> {
> string filename = aspxfile.title;
> }
> thanks
> Andy
>
>
"John Timney ( MVP )" wrote l...

> You can list all the aspx pages using recursion quite easily if you have
> access to the directory structure, open and read each as a text file and
> pick out any title tags.
Hi all,
Feel free to reprimand me with a virtual *SLAP* I'm wrong, but instead of
running through the contents of each page, if you have access to the
directory structure, wouldn't grabbing the file name and looking for files
ending .aspx be quicker?
Regards
Rob
Thanks guys
I was hoping there was some sort of pre existsing 'website' object that
held a collection of all the pages.
not to worry, I have full access so directory recursion it will be
cheers
Andy
"AAJ" <a.a.com> wrote in message
news:%23zXruVLgGHA.2208@.TK2MSFTNGP05.phx.gbl...
> Hi all
> Is it possible to programatically list all the .aspx files within the
> currenty running website.
> e.g. something like
> foreach {aspxfile in AllaspxFilesInMyProject)
> {
> string filename = aspxfile.title;
> }
> thanks
> Andy
>
>
Lol..........thats what I actually suggested, but his code examples
requests extracting the title of each page - consider yourself lightly
splapped!
Regards
John Timney
Microsoft MVP
"Rob Meade" <ku.shn.tsews.thbu@.edaem.bor> wrote in message
news:ucqSDFMgGHA.5104@.TK2MSFTNGP04.phx.gbl...
> "John Timney ( MVP )" wrote l...
>
> Hi all,
> Feel free to reprimand me with a virtual *SLAP* I'm wrong, but instead of
> running through the contents of each page, if you have access to the
> directory structure, wouldn't grabbing the file name and looking for files
> ending .aspx be quicker?
> Regards
> Rob
>

0 comments:

Post a Comment