catching all requests with a single page

G

Guest

I have this idea, I need to know if it is possible and how.

Let's say you have a content managed site with all its structure and content - everything in a relational database

And a "blank" page that loads content from the database. This one single page would have to know what content is requested. Obviously this could be done by pageIDs in querystring and whatnot but this is not what I'd like

Here's what I need

The "blank" page lies in root of the web application and is named Default.aspx. I want every request to the website to be "transferred" to this page. So if someone types http://mysite.com/sales/books I want the "blank" page to be loaded instead of trying to load /sales/books/Default... which doesn't exist. The blank page should read the request URL and separate 'sales' and 'books' from the rest of the URL and using those values load the right content from the database.

If there is no content in the database stored under sales/books the blank page would try to Server.Transfer to a real page that was actually requested '/sales/books'. This isn't really that neccessary for what I have in mind but I'd like to keep the option to load other real existing pages just in case

Can someone point me in the right direction? How to force IIS or the httpapplication to always load the same page no matter what the request URL is
 
K

Kevin Spencer

Very bad idea. You're putting the weight of the entire application on a
single page. While you could certainly create an HttpHandler that would do
this, it would be a waste of time.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Adrijan Josic said:
I have this idea, I need to know if it is possible and how..

Let's say you have a content managed site with all its structure and
content - everything in a relational database.
And a "blank" page that loads content from the database. This one single
page would have to know what content is requested. Obviously this could be
done by pageIDs in querystring and whatnot but this is not what I'd like.
Here's what I need:

The "blank" page lies in root of the web application and is named
Default.aspx. I want every request to the website to be "transferred" to
this page. So if someone types http://mysite.com/sales/books I want the
"blank" page to be loaded instead of trying to load /sales/books/Default...
which doesn't exist. The blank page should read the request URL and separate
'sales' and 'books' from the rest of the URL and using those values load the
right content from the database.
If there is no content in the database stored under sales/books the blank
page would try to Server.Transfer to a real page that was actually requested
'/sales/books'. This isn't really that neccessary for what I have in mind
but I'd like to keep the option to load other real existing pages just in
case.
Can someone point me in the right direction? How to force IIS or the
httpapplication to always load the same page no matter what the request URL
is?
 
G

Guest

The only thing this single page would do is fetch the content from the database and do
this.Controls.Add(this.ParseControl(contentFromDatabase))...
That's basicly all the code the page would have... I don't see how I could split this 'weight' in any way...

since I'm loading controls with ParseControl I can have custom user controls within the content stored in the database that actually have to do some server side work...

So there's not much weight on that single page. All it does is ParseControl(). Menu building and other eventual server side work is done by custom user controls that are embedded within the content stored in the database...
 
G

Guest

Response.Redirect will cause a roundtrip to the client and the address in the clients window will change to what I redirected which i don't want..

also, the CMS doesn't know if the site uses the session... it doesn't have to use a session in other words...
 
B

bruce barker

this is actually pretty easy with .net. You write an application module that
remaps the url path. so http://mysite.com/sales/books would be remapped to
mypage.aspx?l1=sales&l2=books.

see: HttpContent.RewritePath

-- bruce (sqlwork.com)



Adrijan Josic said:
I have this idea, I need to know if it is possible and how..

Let's say you have a content managed site with all its structure and
content - everything in a relational database.
And a "blank" page that loads content from the database. This one single
page would have to know what content is requested. Obviously this could be
done by pageIDs in querystring and whatnot but this is not what I'd like.
Here's what I need:

The "blank" page lies in root of the web application and is named
Default.aspx. I want every request to the website to be "transferred" to
this page. So if someone types http://mysite.com/sales/books I want the
"blank" page to be loaded instead of trying to load /sales/books/Default...
which doesn't exist. The blank page should read the request URL and separate
'sales' and 'books' from the rest of the URL and using those values load the
right content from the database.
If there is no content in the database stored under sales/books the blank
page would try to Server.Transfer to a real page that was actually requested
'/sales/books'. This isn't really that neccessary for what I have in mind
but I'd like to keep the option to load other real existing pages just in
case.
Can someone point me in the right direction? How to force IIS or the
httpapplication to always load the same page no matter what the request URL
is?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top