Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Httpmodule still executed even if remove using <remove> config entry

Reply
Thread Tools

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

 
 
Simon-Pierre Jarry
Guest
Posts: n/a
 
      08-08-2005
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.AppAuthenticati onModule,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

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      08-08-2005
Modules can only be configured in the root web.config in the app.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> 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.AppAuthenticati onModule,Russell.Web
> Backbone.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
>




 
Reply With Quote
 
 
 
 
Henrik
Guest
Posts: n/a
 
      08-10-2005
I haven't tried to use HttpModules so can't really help you, but I DO read
this newsgroup once in while, and I seem to remember reading something about
this kind of problem way back.

Since I haven't doen anything like this myself, I didn't check the
particulars all that close, but I managed to find the conversion from that
post (was in february 2005) here:

http://www.msusenet.com/archive/inde...t-1555956.html

Hope this helps



"Simon-Pierre Jarry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.AppAuthenticati onModule,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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing: default action executed even with Ctrl+Enter Hendrik Maryns Java 4 06-10-2008 03:51 PM
<httpmodule remove> tag not working =?Utf-8?B?QmlsbA==?= ASP .Net 1 11-11-2006 10:05 PM
Programmatically remove a HttpModule kev_Eldridge@yahoo.it ASP .Net 0 06-14-2006 02:47 PM
Help: Add/Remove/Clear HttpModule in subfolder never work! =?Utf-8?B?d2FsdGVy?= ASP .Net 3 05-14-2006 07:47 PM
Remove HttpModule for a subfolder Dominik Amon ASP .Net 2 05-07-2004 06:43 PM



Advertisments