我正在尝试在web.config文件中注册自定义HttpHandler。 MSDN's 示例显示已注释掉的条目...嗯,效果不佳。取消注释后,我会收到Could not load file or assembly 'HttpModule.cs' or one of its dependencies. The system cannot find the file specified.
错误。文件名是HttpModule.cs,类名是MyHttpModule。尚无明确的 namespace 。
<httpModules>
<add name="MyHttpModule" type="MyHttpModule, HttpModule" />
<httpModules>
我敢肯定,我忽略了显而易见的事情。我需要在某处指定文件路径吗?提前致谢。
最佳答案
我仍在学习很多术语,并需要为我阐明。万一您需要同样的...
例如,如果:
TestSite
BusinessLogic
PageAuthorization
在Web.config文件中...
<configuration>
<system.web>
<httpModules>
<add type= "BusinessLogic.PageAuthorization, TestSite" name="PageAuthorization" />
</httpModules>
</system.web>
</configuration>
就我而言,我必须用
IHttpModule
标记类(class)。该类的定义如下所示:public class PageAuthorization : IHttpModule