#if NET_2_0
using System;
+using System.ComponentModel;
using System.Web;
using System.Web.Configuration;
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 ()
{
}
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;
}
}
}
+#if TARGET_JVM
static AnonymousIdentificationSection Config
{
get
{
- return (AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
+ AnonymousIdentificationSection config = (AnonymousIdentificationSection) AppDomain.CurrentDomain.GetData ("Anonymous.Config");
+ if (config == null) {
+ lock (typeof (AnonymousIdentificationModule)) {
+ config = (AnonymousIdentificationSection) AppDomain.CurrentDomain.GetData ("Anonymous.Config");
+ if (config == null)
+ config = (AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
+ AppDomain.CurrentDomain.SetData ("Anonymous.Config", config);
+ }
+ }
+ return config;
}
}
+#else
+ static AnonymousIdentificationSection Config = (AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
+#endif
}
}
#endif