catching all requests with a single page

Discussion in 'ASP .Net' started by =?Utf-8?B?QWRyaWphbiBKb3NpYw==?=, Feb 6, 2004.

  1. 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
     
    =?Utf-8?B?QWRyaWphbiBKb3NpYw==?=, Feb 6, 2004
    #1
    1. Advertising

  2. 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" <_this> wrote in message
    news:...
    > 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?
    >
     
    Kevin Spencer, Feb 6, 2004
    #2
    1. Advertising

  3. 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...
     
    =?Utf-8?B?QWRyaWphbiBKb3NpYw==?=, Feb 6, 2004
    #3
  4. 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...
     
    =?Utf-8?B?QWRyaWphbiBKb3NpYw==?=, Feb 6, 2004
    #4
  5. =?Utf-8?B?QWRyaWphbiBKb3NpYw==?=

    bruce barker Guest

    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" <_this> wrote in message
    news:...
    > 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?
    >
     
    bruce barker, Feb 6, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Arámburu

    web requests and mobile requests

    Fernando Arámburu, Apr 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    447
    Joerg Jooss
    Apr 8, 2005
  2. Craig Edgmon
    Replies:
    0
    Views:
    304
    Craig Edgmon
    Mar 2, 2004
  3. Eric Layman
    Replies:
    3
    Views:
    630
    Rad [Visual C# MVP]
    Apr 14, 2007
  4. Paul Bryant

    Multiple log-in requests for single aspx page - WHY?

    Paul Bryant, Oct 17, 2003, in forum: ASP .Net Security
    Replies:
    1
    Views:
    204
    Jim Cheshire [MSFT]
    Oct 17, 2003
  5. Replies:
    0
    Views:
    166
Loading...

Share This Page