views:

94

answers:

1

Ok

I have a bunch of html pages stored in a mssql database. Each row has:

  • ID
  • PageTitle
  • Page Html Content
  • ParentId

ParentId is there so i can create a hierarchical tree of pages.

Currently i am using this line of code in order to access the pages...

routes.MapPageRoute("front", "{PageTitle}", "~/front.aspx");

Which then causes a redirect to front.aspx so i can then use:

Page.RouteData.Values["PageTitle"].ToString()

In order to grab what i need so i can display the appropriate page in the browser.

However, can anyone suggest how i would amend 'routes.MapPageRoute' so it supports an infinate hierarchical tree like i have in my database. Essentially i want to be able to type a url like: http://localhost/PageOne/SubPageOfPageOne etc

A: 

Changed:

routes.MapPageRoute("front", "{PageTitle}", "~/front.aspx");

to this:

routes.MapPageRoute("front", "{*PageTitle}", "~/front.aspx");

this pulls everything that is in the url (past the domain the name)...

then i used the split function to recursively get each node so i could check if it exists.

Stephen