由于超出本次讨论范围的原因(比如将一个 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
属性时,页面不会引发错误。所以默认情况下,当我们不指定Inherits
属性时,页面继承自System.web.UI.Page
?
我们正在使用 VS2008 Web 应用程序项目并且没有预编译 aspx 页面。我们希望在 HTTPModule(开始请求)中截获对这个页面的请求,如果请求是对 ICustomInterface 类型的页面,我们希望以不同的方式处理它。
如何才能做到这一点 ?