views:

35

answers:

1

for reasons beyond the scope of this discussion (say xcopy an aspx page to a directory, so that we dont have to get a new build out) , we would like to implement an interface in an aspx page.Say, if the page is myPage.aspx, it is usually your class in the codebehind mypage.aspx.cs which implements the interface. When I do something like this

<%@ Page Language="C#" AutoEventWireup="true"  Inherits="ICustomInterface" %>

I get an error

Parser Error Message: 'ICustomInterface' is not allowed here because it does not extend class 'System.Web.UI.Page'.

How ever, when not specifying an Inherits attribute the page does not throw an error. So by default, when we do not specify an Inherits attribute, the page inherits from System.web.UI.Page ?

We are using VS2008 web application project and are not precompiling the aspx pages. We would like to intercept the request to this page in the HTTPModule (begin request) and if the request is to a page of type ICustomInterface we would like to process it differently.

How can this be done ?

+3  A: 

It could be because the Inherits parameter is expecting a base class, not an interface.

You could perhaps try creating a secondary class, which inherits from System.Web.UI.Page and implements the interface you need.

Although, I'm totally just guessing at this.

Kirschstein
+1 good solution; in fact multiple interfaces can be implemented this way
John K