Httpmodule still executed even if remove using <remove> config entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sksmart
    New Member
    • Sep 2008
    • 1

    Httpmodule still executed even if remove using <remove> config entry

    I have added httpmodule but when I am trying to remove it in subdirectory web.config of subdirectory it still get executed.

    Public Sub Init(ByVal context As System.Web.Http Application) Implements System.Web.IHtt pModule.Init

    'add a handler for the PostAutheticati onRequest event. This fires just after authentication has occurred
    AddHandler context.PostAut henticateReques t, AddressOf HandlePostAuste nticationReques t

    End Sub
    Private Sub HandlePostAuste nticationReques t(ByVal sender As Object, ByVal e As EventArgs)
    Dim application As HttpApplication
    Dim req As HttpRequest

    Try
    application = DirectCast(send er, HttpApplication )

    req = application.Req uest

    If req.IsAuthentic ated Then
    Exit Sub
    End If

    Dim redirectUrl As New StringBuilder(" ")
    redirectUrl.App end(FormsAuthen tication.LoginU rl)
    redirectUrl.App end(AUTHENTICAT ION_LOGIN_REDIR ECT_QUERYSTRING )
    redirectUrl.App end(req.Url.Abs oluteUri())

    application.Con text.Response.R edirect(redirec tUrl.ToString)
    End Sub

    In the main web.config I added the following tag:

    <httpModules>
    <add type="Project.A uthorisationRed irect" name="Authorisa tionRedirect" />
    </httpModules>

    In the subdiretory I added
    <httpModules>
    <remove name="Authorisa tionRedirect" />
    </httpModules>
    But it still gets executed. I have tried using clear but not working.

    Thanks
    Sk
Working...