2008-11-06 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.Security / AnonymousIdentificationModule.cs
index 70233c81ea05b04087f6170fad2d66f6b4a18768..b8e7bfa11a4c4284930441cb4f82ff7e5ba63055 100644 (file)
@@ -31,6 +31,7 @@
 #if NET_2_0
 
 using System;
+using System.ComponentModel;
 using System.Web;
 using System.Web.Configuration;
 using System.Text;
@@ -38,9 +39,15 @@ using System.Text;
 namespace System.Web.Security {
 
        public sealed class AnonymousIdentificationModule : IHttpModule {
-
+               static readonly object creatingEvent = new object ();
+               
                HttpApplication app;
-               public event AnonymousIdentificationEventHandler Creating;
+               EventHandlerList events = new EventHandlerList ();
+               
+               public event AnonymousIdentificationEventHandler Creating  {
+                       add { events.AddHandler (creatingEvent, value); }
+                       remove { events.RemoveHandler (creatingEvent, value); }
+               }
 
                public static void ClearAnonymousIdentifier ()
                {
@@ -78,9 +85,10 @@ namespace System.Web.Security {
                        }
 
                        if (anonymousID == null) {
-                               if (Creating != null) {
+                               AnonymousIdentificationEventHandler eh = events [creatingEvent] as AnonymousIdentificationEventHandler;
+                               if (eh != null) {
                                        AnonymousIdentificationEventArgs e = new AnonymousIdentificationEventArgs (HttpContext.Current);
-                                       Creating (this, e);
+                                       eh (this, e);
 
                                        anonymousID = e.AnonymousID;
                                }