This is semi-related to a question I opened a while ago. The way the ASP.NET Forms Authentication module behaves is it registers a subscription to app.AuthenticateRequest
and app.EndRequest
The way forms auth hijacks EndRequest is very poor manners and was a poor design decision making extending Forms Auth excruciatingly complex. Currently I have a nasty implementation that interdicts the redirection to do what I want instead. I've never been pleased with this, random thought occured to me today reviewing this code is there a way I could just unhook
app.EndRequest += new EventHandler(this.OnLeave);
I see that there are potentially relevant answers on How to remove all event handlers from a control but the implementations of these answers seem to vary wildly and appear that they might only be relevant to Control
inheritors.
This most important part is to remove 1 specific event subscription, not blanket nuking. I suppose any solution that can get the subscriptions, nuke them all and then allow me to resubsubscribe for all others is just as valid.