Question on calling system events

D

Duckkiller

Could someone please help: I'm trying to understand how you would call
these two events from a web page. AnonymousIdentification_Creating and
Profile_MigrateAnonymous. The Author of the book I'm reading states that
they can be called from the web page's source. "HOW DO YOU CALL THEM".

I have included what the author of the book I'm reading states about
working with Anonymous Identification. I was able to get the
AnonymousIdentification_Creating to fire by simply placing it in the
Global.asax file. It worked and the AnonymousID changed. Is that because
the sub in Listing 15-15 is actually a delegate to an event? Also, the next
section talks about the Profile_MigrateAnonymous() event and that it can be
placed in the page that deals with the migration. How do you do get it to
fire. Everything that I have read on events states that you delcare and
event, you raise the event, and then you set a sub to be called when the
event fires using the 'Handles' clause. Or you can create a Delegate and
point that delegate to a method with a similar signature. But the below
explanation does not follow any of those rules. Any help would be greatly
appreaciated.

****************************** From the book ******************************

In working with the creation of anonymous users, be aware of an important
event which you can use from your Global.asax file that can be used for
managing the process: AnonymousIdentification_Creating

By using the AnonymousIdentification_Creating event, you can work with the
identification of the end
user as it occurs. For instance, if you do not want to use GUIDs for
uniquely identifying the end user, you can change the identifying value from
this event instead.
To do so, create the event using the event delegate of type
AnonymousIdentificationEventArgs, as illustrated in Listing 15-15.


Listing 15-15:

Public Sub AnonymousIdentification_Creating(ByVal sender As Object, ByVal e
As AnonymousIDentificationEventArgs)
e.AnonymousID = "Anonymous test " & DateTime.Now()
End Sub


The Author Also states this about migrating Anonymous users using
Profile_MigrateAnonymous event handler.



When working with anonymous users, you must be able to migrate anonymous
users to registered users. for example, after an end user fills a shopping
cart, he can register on the site to purchase the items. At that moment,
the end users switches from being an anonymous user to a registered user.
For this reason, ASP.NET provides a Profile_MigrateAnonymoous event handler
enabling you to migrate anonymous users to registered users. The
profile_MigrateAnonymouseevent requires a data class of type
ProfileMigrateEventArgs. It is placed either in the page that deals with
the migration or within the Global.asax file (if it can be used from
anywhere within the application). The use of this event is illustrated in
Listing 15-17

Listing 15-17

Public Sub Profile_MigrateAnonymous(ByVal sender As Object, ByVal e As
ProfileMigrateEventArgs)


Dim anonymousProfile As ProfileCommon =
Profile.GetProfile(e.AnonymousID)
Profile.LastVisited = anonymousProfile.LastVisited


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top