views:

40

answers:

1

Hey,

As explained in the title, I am having a problem with getting the URL of the page being executed from within a page.

Basically I have a dynamic catalogue, where customers select products they are interested in. The manager of the company I am doing this for would like to be able to create an up to date offline catalogue at any given time, to send out to customers who dont have an internet connection. So far its going really well. I am using Server.Execute to get the content for each page, then putting it in static html pages and changing the dynamic links to static html links (ie changing all aspx links to htm). I am able to output all the pages for about us, contact us, home, and the entire catalogue. However, one of the stylesheets which is included in the page based on the URL (if the page is in the administration section then it is not included, otherwise it is) is not being included in the pages when it should be. I have tried outputting the URL but it just returns the URL of the calling page, not the page being called. Does anyone have any idea why this is happening?

Any help would be greatly appreciated.

Regards,

Richard Clarke

A: 

This behavior is by design.

(Request.Url is the URL that was requested by the client)

SLaks
so is there not any way to get the URL of the executed page from within that page?
ClarkeyBoy
Not that I can think of offhand. Why? What are you trying to do?
SLaks
Hmm I think I may have just come up with a solution.. I just noticed that both admin and customer pages inherit from one of two classes - Admin.Page or Customer.Page. Both of these classes set the relevant masterpage and theme in the page_preinit method. If I were to set the stylesheets in these classes too, rather than based on the URL, then it would solve the problem. The strange thing is that the catalogue pages often have a query string containing ItemID. They are picking this up fine, just not the rest of the URL. It seems kinda odd the way it works like that..Thanks anyway.Richard
ClarkeyBoy