Data driven site strategy for normal URLs

  • Thread starter Thread starter nick
  • Start date Start date
N

nick

Hi there,

I'm designing a site with pages where the layout is the same and
content is different. So, obviously, I'm just coding one page and
brining the data in from the database. The drawback to this is that
the URL names aren't really meaningful. For example, let's say I have
an aboutus page and a directions page. In a statically coded site, the
urls might be www.site.com/aboutus.aspx and
www.site.com/directions.aspx. In my case, since I'm using the same
page it would be more like www.site.com/template1.aspx?pageId=6 where
6 is the PK of the page in the database. Is there a way to have the
best of both worlds?

Once solution I've considered is customizing my 404 pages. So a user
could type www.site.com/aboutus.aspx. The 404 page would look up
about.aspx's pageId and server.transfer to
template1.aspx?pageId=[about's pageId]. This doesn't seem particularly
elegant to me.

I was considering making each of the pages and inheriting from a
custom page class, but then I'd still have to hard code the page Id in
each of the pages, which is somewhat messy - especially for adding new
pages dynamically.

Thoughts?
 
Have you looked at HTTPHandlers and the RewritePath function? You can make
pretty much any URL execute pretty much any page on your site.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top