S
Simon-Pierre Jarry
Hi,
I created a custom HttpModule for managing the security of my
application. in "Init" sub, I regsiter the events doing that :
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements
IHttpModule.Init
httpApp = context
AddHandler httpApp.AuthenticateRequest, AddressOf
OnAuthenticateRequest
AddHandler httpApp.AcquireRequestState, AddressOf
OnAcquireRequestState
End Sub
I register the httpModule in the web.config at the root of my
application doing this :
<httpModules>
<add
type="Russell.WebBackbone.Security.AppAuthenticationModule,Russell.WebBackbone.Security"
name="AuthenticationModule" /> </httpModules>
I want the httpModule not to execute on a subfolder called "Public".
In the web.config file of my application at he root, I added this code
:
<location path="Public">
<system.web>
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
<httpModules>
<remove name="AuthenticationModule" />
</httpModules>
</system.web>
</location>
Problem :
The code of the Sub that handle the 2 events register earlier is
still executed, event I asked the HttpModule to be removed on this
folder ?
Clue or hints ? : I noted that, when debugging, the
context.HttpModules collection object at runtime still contains this
"AuthenticationModule"... and should not !! I verified a few time and
the name used to "ADD" the httpModule is the same then the name used to
remove.
Any idea ??
I read somewhere that because the httpApplication object is "global"
so, event if the httpModule is removed, the event handlers are still
attached, so will be executed. Is it true ? If yes, any suggestion to
detach those at a correct time ?
Thanks a lot for your help !
Simon-Pierre
I created a custom HttpModule for managing the security of my
application. in "Init" sub, I regsiter the events doing that :
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements
IHttpModule.Init
httpApp = context
AddHandler httpApp.AuthenticateRequest, AddressOf
OnAuthenticateRequest
AddHandler httpApp.AcquireRequestState, AddressOf
OnAcquireRequestState
End Sub
I register the httpModule in the web.config at the root of my
application doing this :
<httpModules>
<add
type="Russell.WebBackbone.Security.AppAuthenticationModule,Russell.WebBackbone.Security"
name="AuthenticationModule" /> </httpModules>
I want the httpModule not to execute on a subfolder called "Public".
In the web.config file of my application at he root, I added this code
:
<location path="Public">
<system.web>
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
<httpModules>
<remove name="AuthenticationModule" />
</httpModules>
</system.web>
</location>
Problem :
The code of the Sub that handle the 2 events register earlier is
still executed, event I asked the HttpModule to be removed on this
folder ?
Clue or hints ? : I noted that, when debugging, the
context.HttpModules collection object at runtime still contains this
"AuthenticationModule"... and should not !! I verified a few time and
the name used to "ADD" the httpModule is the same then the name used to
remove.
Any idea ??
I read somewhere that because the httpApplication object is "global"
so, event if the httpModule is removed, the event handlers are still
attached, so will be executed. Is it true ? If yes, any suggestion to
detach those at a correct time ?
Thanks a lot for your help !
Simon-Pierre