Global.asax是HttpHandler还是HttpModule?

问题描述 投票:0回答:1

[我在采访中被问到有关Global.asax及其功能的问题,然后问我HttpHandlerHttpModule之间有什么区别?根据我的理解,我回答为HttpModule,因为HttpModule在请求管道中,而HttpHandler负责生成响应。

但是当我查看Global.asax基类时,我看到它继承自IHttpHandler

为什么Global.asax在不处理请求时应被视为处理程序?

asp.net httphandler global-asax httpmodule
1个回答
0
投票

Global.asax实现了IHttpHandler(以及其他接口),但还派生自基类HttpApplication,是的,它确实处理请求,如从反编译HttpApplication中看到的那样。

© www.soinside.com 2019 - 2024. All rights reserved.