As Lee has pointed out the best way is to set a class for the master page to inherit from, this will give you (some) access to code behind on ever request processed.
All requests will have the events/ properties/ members of System.Web.UI.MasterPage run through your class on each request, but keep in mind that this is different to having System.Web.UI.Page as the base.
There's no way without a huge amount of work to route through your own class which inherits from Page, essentially that requires rewriting the Umbraco request pipeline, something that you don't want to enter into lightly.
Maybe if you explain what you're trying to achieve we can give more options to you, as a HttpModule may be a valid idea.
Make all pages inherit from a custom class?
Hi All,
just wondering if there was a way to get all pages for my umbraco solution to inherit from a base class i want to write..
i have a scenario where i want the same behaviour for every page in the system.. ie
public
abstract class MyCustomPage :
Page or UmbracoPage or whatever the base page type is
{
cheers,
Tom
Hi Tom,
(I think some of your original post got cut-off?)
Are you referring to your front-end ASPX pages? If so, then you can do the following:
Create your new base page class, inheriting from "umbraco.UmbracoDefault". Then edit the "/default.aspx", and change the "Inherits" reference:
Hope that helps?
Good luck, Lee.
If i have a master document type does that create a class i can extend?
Master document-type? or MasterPage (template)?
Doc-type - no, they don't have a class - they are Umbraco-specific; completely outside of the ASP.NET framework.
MasterPages can have code-behind (or even inline-code) classes that you can extend/inherit. It all comes down to what you want to do?
What is the behaviour that you want on every page? (your code-snippet got cut-off in your original post).
Thanks, Lee.
As Lee has pointed out the best way is to set a class for the master page to inherit from, this will give you (some) access to code behind on ever request processed.
All requests will have the events/ properties/ members of System.Web.UI.MasterPage run through your class on each request, but keep in mind that this is different to having System.Web.UI.Page as the base.
There's no way without a huge amount of work to route through your own class which inherits from Page, essentially that requires rewriting the Umbraco request pipeline, something that you don't want to enter into lightly.
Maybe if you explain what you're trying to achieve we can give more options to you, as a HttpModule may be a valid idea.
Thanks guys.. i got around it by writing a module instead but still was interesting to know!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.