QueryStrings, what and how to use them

Winston

Junior Contributor
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
I've been wondering some sites who uses asp.net have just one single page

like main.aspx, that's it, and they use query strings like ?page=about

my question is, how do u implement this in asp.net and how does it work in general, like is it just one .aspx file ur dealing with and u populate the page based on what the query string is? :S... like is this a feasible way of implementing i mean what about static contents which remain the same at times, for example the about page or contact page.

Wouldn't you have a big switch/case statement?

select case page

case "about"
'dynamically load contents..

end select

is that how it works?

please give me some insigt into this way of implementing sites, thank you :)
 
Yes, you could do a big select case, or you could pass in a ID, such as

page.aspx?id=1

And you store this ID in a db with its contents. You are correct, page.aspx is just one page thaty dynamically serves up content based on varying paramters(querystrings). The source of the content is up to you, text files, inline code, database. If your content does not change much, think about generateing static pages instead of processing a request everytime. Also, some search engines dont like the ? and will chop off any paramters after that, so your site wont be as visible when it comes to spidering.
 
Back
Top