Tricky URL Rewrite question

Discussion in 'ASP .Net' started by aag, Sep 15, 2008.

  1. aag

    aag Guest

    Hey there! I've got an URL rewrite issue that I'm wondering if the
    masters out there can help with :)

    I have a site that resides at (for example) foo.com - it's a full
    site with tons of pages that users would need to get access to.

    However, I'd like to have a special feature of that same ASP.NET
    application such that if a users goes to:

    bla.foo.com/name

    It would actually redirect via URL rewrite to foo.com/function.aspx?
    ident=<i>name</i>

    Is that possible? Or do I need to write an HTTP handler to intercept
    ALL http traffic, search for the URL, forward if necessary, or pass on
    to the default handler if not? (how do you pass a request on to the
    default handler in an HTTP Handler, anyway?)
     
    aag, Sep 15, 2008
    #1
    1. Advertising

  2. aag wrote:
    > Hey there! I've got an URL rewrite issue that I'm wondering if the
    > masters out there can help with :)
    >
    > I have a site that resides at (for example) foo.com - it's a full
    > site with tons of pages that users would need to get access to.
    >
    > However, I'd like to have a special feature of that same ASP.NET
    > application such that if a users goes to:
    >
    > bla.foo.com/name
    >
    > It would actually redirect via URL rewrite to foo.com/function.aspx?
    > ident=<i>name</i>
    >
    > Is that possible? Or do I need to write an HTTP handler to intercept
    > ALL http traffic, search for the URL, forward if necessary, or pass on
    > to the default handler if not? (how do you pass a request on to the
    > default handler in an HTTP Handler, anyway?)
    >


    You can put code in the Application_BeginRequest method in global.asax
    to check the url of every request that reaches the ASP.NET engine.
    However, that only works for requests that actually are handled by
    ASP.NET, which an url like bla.foo.com/name is not.

    The same goes for an HttpHandler, it can only catch requests that are
    handled by ASP.NET.

    We use a component named IIS Mod-Rewrite. It's an ISAPI dll that gets
    installed in the web application in IIS, and it intercepts the request
    before it's handled.

    There are some free components out there also, unless your server is 64-bit.

    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    Göran Andersson, Sep 15, 2008
    #2
    1. Advertising

  3. aag

    aag Guest

    Unfortunately, we are indeed using 64 bit - however, I'm pretty sure
    we're using "urlreqwriting.net" already. I'll have to see how that
    works... do you think that could do the job for us?

    We're running Windows Server 2008 and IIS7, so that might give us some
    additional leeway in forwarding all requests to the ASP.NET handler,
    but I'm not quite sure on the exact steps I should take for that.

    However - you're sure that bla.foo.com/name wouldn't be handled by
    ASP.NET? I mean, doesn't it attempt to look for default.aspx in the
    directory "bla.foo.com/name", or does it do a redirect first before
    being processed by ASP.NET?

    Thanks for answering and helping...! It's greatly appreciated.




    On Sep 15, 5:48 am, Göran Andersson <> wrote:
    > aag wrote:
    > > Hey there!  I've got an URL rewrite issue that I'm wondering if the
    > > masters out there can help with :)

    >
    > > I have a site that resides at (for example)  foo.com - it's a full
    > > site with tons of pages that users would need to get access to.

    >
    > > However, I'd like to have a special feature of that same ASP.NET
    > > application such that if a users goes to:

    >
    > > bla.foo.com/name

    >
    > > It would actually redirect via URL rewrite to foo.com/function.aspx?
    > > ident=<i>name</i>

    >
    > > Is that possible?  Or do I need to write an HTTP handler to intercept
    > > ALL http traffic, search for the URL, forward if necessary, or pass on
    > > to the default handler if not?  (how do you pass a request on to the
    > > default handler in an HTTP Handler, anyway?)

    >
    > You can put code in the Application_BeginRequest method in global.asax
    > to check the url of every request that reaches the ASP.NET engine.
    > However, that only works for requests that actually are handled by
    > ASP.NET, which an url like bla.foo.com/name is not.
    >
    > The same goes for an HttpHandler, it can only catch requests that are
    > handled by ASP.NET.
    >
    > We use a component named IIS Mod-Rewrite. It's an ISAPI dll that gets
    > installed in the web application in IIS, and it intercepts the request
    > before it's handled.
    >
    > There are some free components out there also, unless your server is 64-bit.
    >
    > --
    > Göran Andersson
    > _____http://www.guffa.com- Hide quoted text -
    >
    > - Show quoted text -
     
    aag, Sep 15, 2008
    #3
  4. aag

    CJM Guest

    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. Michel

    Rewrite URL with Session possible?

    Michel, Dec 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    421
    Michel
    Dec 9, 2003
  2. Patrick.O.Ige

    Url rewrite question

    Patrick.O.Ige, Jul 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    364
    Patrick.O.Ige
    Jul 8, 2005
  3. =?Utf-8?B?VA==?=

    Rewrite asp url as aspx url?

    =?Utf-8?B?VA==?=, Jul 22, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    736
    gerry
    Jul 24, 2005
  4. Replies:
    9
    Views:
    547
    CBFalconer
    Apr 25, 2006
  5. Martin
    Replies:
    0
    Views:
    1,247
    Martin
    Apr 28, 2010
Loading...

Share This Page