[Mono-dev] Profile_MigrateAnonymous event not firing

Mark Walmsley mail at markwalmsley.net
Sun Aug 23 06:26:12 EDT 2009


Hi 

I'm running Mono on SuSE Linux 11.1 and Apache 2.2 and I am trying to use
the MigrateAnonymous event from the Profile module but it does not seem to
fire when it should ... 

So far I've have the following in my Global.asax file: 

<%@Application Language="C#"%> 
<Script RunAt="server"> 
  public override void Init() { 
    Application["MyString"] = "Init in Global.asax was called"; 
    ((ProfileModule)Modules["Profile"]).MigrateAnonymous +=
Profile_MigrateAnonymous; 
   
((AnonymousIdentificationModule)Modules["AnonymousIdentification"]).Creating
+= AnonymousIdentification_Creating; 
  } 
  void AnonymousIdentification_Creating(Object sender,
AnonymousIdentificationEventArgs e) { 
    Application["MyString"] = "AnonymousIdentification_Creating in
Global.asax was called"; 
  } 
  void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e) { 
    Application["MyString"] = "Profile_MigrateAnonymous in Global.asax was
called"; 
  } 
</Script> 

(I'm adding the event handlers AnonymousIdentification_Creating and
Profile_MigrateAnonymous explicitly as they are apparently not wired up
automatically.) 

On a test page I've added the following test code: 

    <Script RunAt="server"> 
      protected void Page_Load(object sender, EventArgs e) { 
        string[] modules =
HttpContext.Current.ApplicationInstance.Modules.AllKeys; 
        string s = ""; 
        foreach (string module in modules) { 
          s += (module + "<br>"); 
        } 
        if (Application["MyString"] != null) { 
          s += ((string)Application["MyString"] + "<br>"); 
        } 
        MyMessage.Text = s; 
      } 
    </Script> 


This prints out the following modules: 

FormsAuthentication 
OutputCache 
RoleManager 
Session 
UrlAuthorization 
Profile 
AnonymousIdentification 
DefaultAuthentication 

(The Profile and AnonymousIdentification modules only appear if I add them
in the machine-wide web.config file and not if I add then in the
application's Web.Config file.) 

It also prints "Init in Global.asax was called" as expected and if I delete
my browser cookies and then create a new anonymous user cookie it prints
"AnonymousIdentification_Creating in Global.asax was called" instead. 

However, when I log in as an authorized user it does not print the message
"Profile_MigrateAnonymous in Global.asax was called" as I thought it would
and as far as I can tell the event handler Profile_MigrateAnonymous() is not
called. 

Any help would be much appreciated. 

Thanks 
Mark 

-- 
View this message in context: http://www.nabble.com/Profile_MigrateAnonymous-event-not-firing-tp25102036p25102036.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list