HttpModule 不会触发
我的类库中有一个名为 API 的 httpmodule 类,该类库中的 httpmodule 名为 FileUploadModule.vb。
我已在 system.web
部分中使用
注册了 httpmodule。
这是注册 httpmodule 的正确方法吗?
当我调试 vb.net 2.0 框架 Web 应用程序时,为什么我的 httpmodule 不会触发?
Public Class FileUploadModule
Implements IHttpModule
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.BeginRequest, AddressOf OnBeginRequest
End Sub
Public Sub OnBeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim app As HttpApplication = CType(sender, HttpApplication)
app.Context.Response.Write("ddddddddddddddddddd")
End Sub
End Class
I have an httpmodule class in my class library called API and the httpmodule in this class library is called FileUploadModule.vb.
I have registered the httpmodule in the system.web
section with <add name="FileUploadModule" type="FileUploadModule, API" />
.
Is this the correct way to register an httpmodule?
Why won't my httpmodule fire when i debug the vb.net 2.0 framework web application?
Public Class FileUploadModule
Implements IHttpModule
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.BeginRequest, AddressOf OnBeginRequest
End Sub
Public Sub OnBeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim app As HttpApplication = CType(sender, HttpApplication)
app.Context.Response.Write("ddddddddddddddddddd")
End Sub
End Class
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题似乎与注册有关。
你的程序集名称是API吗?
problem seems about registering.
is your assembly name is API?
我发现一篇关于堆栈溢出的文章也对我有帮助,@adt 也为我指出了正确的方向并使其正常工作,
基本上我添加了在以下位置注册了 httpmodule:-
它起作用了!
我在 stackoverflow 上发现有用的文章位于 "500 Internal在我的网站中添加 HttpModule 时出现“服务器错误”?。
I found an article on stack overflow that helped me also and @adt pointed me in the right direction aswell and got it to work,
Basically i added registered the httpmodule in:-
And it worked!.
The article i found usefule on stackoverflow was at "500 Internal Server Error" when adding HttpModule in my Website?.