Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Problem with module UrlRewrite to web application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Winward - 15 Feb 2008 10:41 GMT
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
Matt Winward - 15 Feb 2008 11:58 GMT
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.
Matt Winward - 15 Feb 2008 15:42 GMT
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);
Matt Winward - 18 Feb 2008 08:44 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.