出于超出本讨论范围的原因(例如,将一个aspx页面复制到一个目录,这样我们就不必进行新的构建),我们希望在一个aspx页面中实现一个接口。例如,如果该页面是myPage.aspx,则通常是myPage.aspx.cs代码背后的类实现了该接口。当我这样做的时候
<%@ Page Language="C#" AutoEventWireup="true" Inherits="ICustomInterface" %>
我出错了
Parser Error Message: 'ICustomInterface' is not allowed here because it does not extend class 'System.Web.UI.Page'.
Inherits
属性页不会引发错误。因此,默认情况下,当我们不指定
继承
System.web.UI.Page
?
我们正在使用VS2008 web应用程序项目,并且没有预编译aspx页面。我们希望在HTTPModule(begin request)中拦截对该页面的请求,如果请求是对ICustomInterface类型的页面的请求,我们希望以不同的方式处理它。
如何做到这一点?