Tricky URL Rewrite question

  • Thread starter Thread starter aag
  • Start date Start date
A

aag

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 said:
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.
 
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.
 
Back
Top