I want to be able to extend the System.Web.UI.Page class and then easily access those properties from the Markup. I know I can do it from the codebehind, but is it possible from the Markup? Take the following class.
public class MyBasePage : System.Web.UI.Page {
public bool DoesThisWork { get; set; }
}
Then I want to be able to access it from the html markup, perhaps in the @Page directive.
<%@Page Language="C#" DoesThisWork="False" ... %>
Of course the above Page is using the MyBasePage class instead of System.Web.UI.Page.
I think the question is focused on how to use custom properties in the page directive – and the answer depends on whether you’re using a Web Application project or Web Site.
For a Web Site, you need to assign CodeFileBaseClass to a non-partial class (under App_Code or in an external assembly). For Web Application, setting the Inherits directive should suffice.