HttpModule wont fire

不想你离开。 提交于 2019-12-13 03:19:40

问题


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

回答1:


problem seems about registering.

<httpModules>
    <add type="classname, assemblyname" name="modulename"  />
<httpModules>

is your assembly name is API?




回答2:


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:-

<system.webServer>
  <modules>
     <add name="FileUploadModuleControl" type="API.FileUploadModuleControl"/>
  </modules>

And it worked!.

The article i found usefule on stackoverflow was at "500 Internal Server Error" when adding HttpModule in my Website?.



来源:https://stackoverflow.com/questions/5149004/httpmodule-wont-fire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!