Reputation: 858
I am trying to set a custom property "DisableBrowserCache" on the page directive like so
<%@ Page Language="VB" AutoEventWireup="false" DisableBrowserCache="True"
CodeFile="Info-services.aspx.vb" Inherits="Manager_Info_services" %>
This is the inheritance chain
Partial Class Manager_Info_services
Inherits EltApp.ELTPage
'Code
End Class
Namespace EltApp
Public Class ELTPage
Inherits System.Web.UI.Page
Public Property DisableBrowserCache() As Boolean
Get
Return _DisableBrowserCache
End Get
Set(value As Boolean)
_DisableBrowserCache = value
End Set
End Property
End Class End Namespace
As you can see I inherit from a class that inherits from System.Web.UI.Page. This issue is that setting the property on the directive gives me the following error
System.Web.HttpParseException (0x80004005):
Error parsing attribute 'disablebrowsercache':
Type 'System.Web.UI.Page' does not have a public property named 'disablebrowsercache'.
---> system.Web.HttpParseException (0x80004005):
Error parsing attribute 'disablebrowsercache':
Type 'System.Web.UI.Page' does not have a public property named 'disablebrowsercache'.
---> System.Web.HttpException (0x80004005):
Error parsing attribute 'disablebrowsercache':
Type 'System.Web.UI.Page' does not have a public property named 'disablebrowsercache'.
at System.Web.UI.TemplateParser.ProcessError(String message)
at System.Web.UI.TemplateControlParser.ProcessUnknownMainDirectiveAttribute(String filter, String attribName, String value)
I have a feeling it's because im not directly inheriting from System.Web.UI.Page in the codebehind file.
Upvotes: 0
Views: 1342
Reputation: 25063
That's not the way the Page directive works. You're asking it to understand your derived class even before the page is parsed.
You should put this in the Page_Init()
event of Manager_Info_services
.
Upvotes: 1