PC Review


Reply
Thread Tools Rate Thread

Calling Events from web page

 
 
Duckkiller
Guest
Posts: n/a
 
      8th Nov 2009
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.

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.

Any help would be greatly appreaciated

Thanks

Dave

****************************** 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

 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      11th Nov 2009
"Duckkiller" <(E-Mail Removed)> wrote in
news:F79B3CDB-44D7-4D57-A120-(E-Mail Removed):

> 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.


he actually states, although not emphatically, that you can code them in
the global.asax file. It is the global handler for the application and
session.

These are events fired, and they need to be handled by a file that is
called as part of the normal ASP.NET process. The page is at a higher
level in the "stack", so to speak, so it cannot directly handle the
event, at leats not without a lot of kludging.

If you want to handle the event, you can do it in the global.asax file.
If you need to do something with it from the page, you will have to
store it where it can be pulled. Session might be an option, as you need
some separation of different anonymous calls. You can also create a
custom property bag, but it would have to be cleaned out over time, so
session is probably easiest. ;-)

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
On Click Events Calling forms Rob Microsoft Access Forms 1 25th Aug 2009 01:12 PM
Avoid calling events on page refresh =?Utf-8?B?UHJpeWE=?= Microsoft ASP .NET 2 21st Feb 2006 02:56 PM
Calling Events Kiran Microsoft ASP .NET 2 26th Apr 2005 06:21 PM
Calling Events James Microsoft Dot NET Framework 1 6th Apr 2005 05:24 PM
Calling events in c#?? =?Utf-8?B?SWFu?= Microsoft Dot NET Compact Framework 4 15th Mar 2005 04:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:15 PM.