473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Context.RewritePath and master pages

Hiya...

just wondering if anyone else has come across this problem, and if there is
a solution...

i'm writing a reasonably simple IHttpModule to rewrite URLs ...

in the BeginRequest event i do a app.Context.RewritePath("~/"+theFile,false)
to the aspx file to display the content, then in the
PreRequestHandlerExecute i do another RewritePath so that all the relative
links (css, images, postabcks, ajax etc..) find thier correct locations...

this works fine, as long as the aspx page is not inside a master page...

when the aspx page uses a master page, the RewritePath only fixes the
relative links contained in the master page and all the relative paths in
the content page don't change!!

is this a bug? or am i missing something?

any help is much appreciated..

thanks k

Oct 14 '08 #1
1 3442
Keef wrote:
Hiya...

just wondering if anyone else has come across this problem, and if there
is a solution...

i'm writing a reasonably simple IHttpModule to rewrite URLs ...

in the BeginRequest event i do a
app.Context.RewritePath("~/"+theFile,false) to the aspx file to display
the content, then in the PreRequestHandlerExecute i do another
RewritePath so that all the relative links (css, images, postabcks, ajax
etc..) find thier correct locations...

this works fine, as long as the aspx page is not inside a master page...

when the aspx page uses a master page, the RewritePath only fixes the
relative links contained in the master page and all the relative paths
in the content page don't change!!

is this a bug? or am i missing something?

any help is much appreciated..

thanks k
The RewritePath doesn't change any links at all, neither in the master
page nor the content page. It changes the requests, and those are the
same regardless if they come from code that was generated by the master
page or the content page. The browser doesn't even know the difference.

I think that your problem is that the URLs that you put in your code is
resolved from the path of the source file instead of the path that is
used to request the page.

I recently deployed URL rewriting on a site, and that involves a
completely different way of handling the URLs in the site. The built-in
methods in ASP.NET for resolving URLs are totally thrown off, and you
have to take complete control over how the URLs are created. I even had
to add code to change the URL that is placed in the action property of
the form tag, because ASP.NET can't even make a postback any more.

--
Göran Andersson
_____
http://www.guffa.com
Oct 14 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt Howeson | last post by:
Some time ago I posted a request for help with a problem I was having sometime ago whereby a 404 error would result if any access to the Querystring had been made before the Context.Rewritepath is...
0
by: Ayende Rahien | last post by:
I've a very annoying problem, I'm using Application_BeginRequest() and Context.RewritePath to hide query strings. The problem that I've is that a form that I submit to /Comments/17.aspx has form...
0
by: Ayende Rahien | last post by:
I've a very annoying problem, I'm using Application_BeginRequest() and Context.RewritePath to hide query strings. The problem that I've is that a form that I submit to /Comments/17.aspx has form...
2
by: Corey O'Mara | last post by:
Hello all, I'd like to have personalized URL's in my application. For example, http://mydomain.com/sites/page.aspx should be accessible via http://mydomain.com/sites/username/page.aspx. I'd like...
8
by: Jiho Han | last post by:
Can someone explain in layman's term, what HttpContext.RewritePath does? SDK doc explanation is kind of scant. Does it only affect the request processing for the duration of the processing(meaning...
1
by: Oytun YILMAZ | last post by:
Hi I thing I have found a critical bug about ASP.NET ReWritePath Function Here are the steps to reproduce: I have a solution with this items: "MasterPageWithoutUserControl.aspx"...
1
by: John | last post by:
1. can I use RewritePath in global.asax workin on Dev 2005 express? the self IIS using some port So I dont know if thats make the problam of 404 2. can i make new project in Dev 2005 express...
3
by: asanford | last post by:
I want to create an ASP.NET web application that receives a form POST message, inspects the data, and reroutes the request to one of many different servers. I wrote an IHttpModule which...
1
by: Alan Silver | last post by:
Hello, I have a page where site owners can see orders placed on their site. The path to this page is /dap/order.aspx, but for security reasons (as they will end up printing these pages and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.