Problem with module UrlRewrite to web application

M

Matt Winward

Hi all.

If anyone can solve this problem, I'd be very grateful.

I've put together a web application that will run within a virtual
directory and uses an HttpHandler to parse requested URLs and loads a
different page in the background, depending on the URL requested.

So http://www.domain.com/VirtualDirectory/<<Customer>>/ actually loads
http://www.domain.com/VirtualDirectory/Default.aspx with some query
string info. So each of the customer subfolders don't really exist ...
they're just used to load content managed sites. The same goes for
each page name ... the handler looks up the customer and the page in
the database and tells Default.aspx to load the right content.

This works great.

But now I want to use an HttpModule at the top level so that
http://www.domain.com/<<Customer>> uses a UrlRewrite to actually load
http://www.domain.com/VirtualDirectory/<<Customer>>/.

This essentially works, but unfortunately it effectively is still
working out of the top level directory, so it's looking for my
assemblies (like the handler, for instance) in /bin rather than in /
VirtualDirectory/bin.

Is there any way I can do a UrlRewrite and effectively transfer
everything over to the web application, rather than it all still being
handled by the parent application? I gather that if I had IIS 7
available to me I could use Server.TransferRequest, which I believe
might make all the difference, but I'm only guessing ... and I can't
use IIS 7 at the moment!

Any ideas would be great. At the moment my only option is to move the
web app to the root folder so that all DLLs are in the top level bin
folder... I'd just have to give it a subfolder and renamed some files
and redo the handler extensions. But I'd rather not do that if there's
a more elegant solution.

Thanks in advance,

Matt
 
M

Matt Winward

Just to clarify with a more simplistic summary, I've got the following
structure:

- \wwwroot
- - - \bin
- - - - - - MyHttpModule.dll
- - - \webapp
- - - - - - \bin
- - - - - - - - - MyHttpHandler.dll
- - - - - - - - - MyBusinessLogicLayer.dll
- - - - - - - - - MyHelperClasses.dll

When the module in wwwroot fires and rewrites the URL to point to the
'webapp', it's all still "working" in the wwwroot folder, so when the
webapp looks for any of the other DLLs (MyHttpHandler etc), it's
looking in the wwwroot bin folder, rather than the webapp bin folder.

I effectively need to do a Response.Redirect, but without changing the
URL.

I've looked into Assembly Probing to see if I could get it to check
the webapp bin folder as well, but this did not work at all ... and
I'm not convinced this would solve the problem anyway.
 
M

Matt Winward

Sorry. Slight correction to my original post. This is the line I'm
using in the module to rewrite the URL:

HttpContext.Current.RewritePath(newurl);
 
M

Matt Winward

A quick update for anyone interested.

I played around with assembly probing and sticking the assemblies in
the GAC, but couldn't get it to work properly. Unless I do a
Response.Redirect, it remains running from the root directory.

So I'm now rewriting it so that the whole lot runs from the root
directory with a subfolder and I've moved my handler code into the
module so that it can load the appropriate content based on the URL.
 

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,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top