Serving pages which do not exist

Discussion in 'ASP .Net' started by Peter Morris [Droopy eyes software], Jan 15, 2005.

  1. Hi all

    Instead of a url like so

    http://www.howtodothings.com/viewarticle.aspx?id=1

    I'd like to do this

    http://www.howtodothings.com/articles/computers/dotnet/aspdotnet/001.html


    I don't want to have to create all of the subfolders + html files etc. I
    vaguely remember reading somewhere that it is possible to do this. Where
    IIS receives a request for a specific page, but the request is actually
    internally mapped to something else (the first url I showed).

    Could someone tell me how this is done please, or maybe let me have a URL
    explaining it?

    Thanks


    --
    Pete
    ====
    ECO Modeler, Audio compression components, DIB graphics controls,
    FastStrings
    http://www.droopyeyes.com

    Read or write articles on just about anything
    http://www.HowToDoThings.com

    My blog
    http://blogs.slcdug.org/petermorris/
    Peter Morris [Droopy eyes software], Jan 15, 2005
    #1
    1. Advertising

  2. By the way, this also needs to be done in code, not statically in a config
    file or something.
    Peter Morris [Droopy eyes software], Jan 15, 2005
    #2
    1. Advertising

  3. The concept is called URL Rewriting. Theres lots of good examples about to
    learn from and give you a starting point to make something fit for your
    exact requirement.

    http://www.google.co.uk/search?hl=en&q=asp.net url rewriting&btnG=Google Search&meta=

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "Peter Morris [Droopy eyes software]" <>
    wrote in message news:uuO1TIv%...
    > Hi all
    >
    > Instead of a url like so
    >
    > http://www.howtodothings.com/viewarticle.aspx?id=1
    >
    > I'd like to do this
    >
    > http://www.howtodothings.com/articles/computers/dotnet/aspdotnet/001.html
    >
    >
    > I don't want to have to create all of the subfolders + html files etc. I
    > vaguely remember reading somewhere that it is possible to do this. Where
    > IIS receives a request for a specific page, but the request is actually
    > internally mapped to something else (the first url I showed).
    >
    > Could someone tell me how this is done please, or maybe let me have a URL
    > explaining it?
    >
    > Thanks
    >
    >
    > --
    > Pete
    > ====
    > ECO Modeler, Audio compression components, DIB graphics controls,
    > FastStrings
    > http://www.droopyeyes.com
    >
    > Read or write articles on just about anything
    > http://www.HowToDoThings.com
    >
    > My blog
    > http://blogs.slcdug.org/petermorris/
    >
    >
    John Timney \(ASP.NET MVP\), Jan 15, 2005
    #3
  4. Peter Morris [Droopy eyes software]

    Dave Fancher Guest

    The February 2005 issue of MSDN Magazine has an article that touches on
    this. An older issue covers the same subject as well.

    In the Feb 2005 issue, they use an HttpModule but this can also be
    implemented just as easily in the Application_BeginRequest event in
    global.asax which is what i typically use. [Figure 3 includes a code
    listing for rewriting a URL]

    http://msdn.microsoft.com/msdnmag/issues/05/02/InsideMSDN/default.aspx

    --
    Dave Fancher
    http://davefancher.blogspot.com


    "Peter Morris [Droopy eyes software]" <>
    wrote in message news:uuO1TIv%...
    > Hi all
    >
    > Instead of a url like so
    >
    > http://www.howtodothings.com/viewarticle.aspx?id=1
    >
    > I'd like to do this
    >
    > http://www.howtodothings.com/articles/computers/dotnet/aspdotnet/001.html
    >
    >
    > I don't want to have to create all of the subfolders + html files etc. I
    > vaguely remember reading somewhere that it is possible to do this. Where
    > IIS receives a request for a specific page, but the request is actually
    > internally mapped to something else (the first url I showed).
    >
    > Could someone tell me how this is done please, or maybe let me have a URL
    > explaining it?
    >
    > Thanks
    >
    >
    > --
    > Pete
    > ====
    > ECO Modeler, Audio compression components, DIB graphics controls,
    > FastStrings
    > http://www.droopyeyes.com
    >
    > Read or write articles on just about anything
    > http://www.HowToDoThings.com
    >
    > My blog
    > http://blogs.slcdug.org/petermorris/
    >
    Dave Fancher, Jan 15, 2005
    #4
  5. Peter Morris [Droopy eyes software], Jan 16, 2005
    #5
  6. Peter Morris [Droopy eyes software]

    Teemu Keiski Guest

    Hello,

    map *.* extensions to ASP.NET (aspnet_isapi.dll) so that all requests not
    mapped to elsewhere are processed by it (note that this can cause
    performance burden on the server), and then at ASP.NET side you can map a
    HTTP handler to this * extension whichs again solves what action should be
    done based on query string.

    Note that you can also do some tricks onfiguring IIS such that when ever a
    page requested is not found it redirects to a custom page (your page) with
    certain parameters and you can again in your logic decide what to do based
    on the parameters.


    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU


    "Peter Morris [Droopy eyes software]" <>
    wrote in message news:uuO1TIv%...
    > Hi all
    >
    > Instead of a url like so
    >
    > http://www.howtodothings.com/viewarticle.aspx?id=1
    >
    > I'd like to do this
    >
    > http://www.howtodothings.com/articles/computers/dotnet/aspdotnet/001.html
    >
    >
    > I don't want to have to create all of the subfolders + html files etc. I
    > vaguely remember reading somewhere that it is possible to do this. Where
    > IIS receives a request for a specific page, but the request is actually
    > internally mapped to something else (the first url I showed).
    >
    > Could someone tell me how this is done please, or maybe let me have a URL
    > explaining it?
    >
    > Thanks
    >
    >
    > --
    > Pete
    > ====
    > ECO Modeler, Audio compression components, DIB graphics controls,
    > FastStrings
    > http://www.droopyeyes.com
    >
    > Read or write articles on just about anything
    > http://www.HowToDoThings.com
    >
    > My blog
    > http://blogs.slcdug.org/petermorris/
    >
    Teemu Keiski, Jan 23, 2005
    #6
    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. Pradeep Kumar

    Serving ASP .NET pages from a Linux Server

    Pradeep Kumar, Nov 10, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    528
    Thomas F.B.
    Nov 10, 2003
  2. Mike Kiefer
    Replies:
    1
    Views:
    386
    Mike Kiefer
    Sep 21, 2004
  3. Frankie
    Replies:
    3
    Views:
    4,722
    Frankie
    Jul 15, 2005
  4. Replies:
    2
    Views:
    463
  5. Kaze
    Replies:
    0
    Views:
    227
Loading...

Share This Page