question about profil and global.asax

B

benny

Hi,

i'm trying to transform an anonymous user profile to an authenticated user
profile.

I found this global.asax here below and there are some things i don't
understand.
1) where does the last function come from ( Public Sub
Profile_OnMigrateAnonymous) because in VWDeveloper, that event doesn't
appear in the available list of events?
2) when is it executed because it's not in the "Application_Start" (or _end)
neither in "session_start"? On request?
3) in that function, there is a class defined 'ProfileCommon'. I discovered
that that class was generated by a 'tool' and is not located in the
application directory but in c:\windows\microsoft.net\v2..\Temporary Asp.net
files\...\...\profile.cdcab7d2.vb .
What tool is that and when was it generated? Why is not located in the
application directory?

Thanks
Benny

<%@ Application Language="VB" %>
<%@ Import Namespace="System.Web.Profile" %>
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
End Sub

Public Sub Profile_OnMigrateAnonymous(ByVal Sender As Object, ByVal e As
ProfileMigrateEventArgs)
' get the profile for the anonymous user
Dim anonProfile As ProfileCommon = Profile.GetProfile(e.AnonymousID)

' if they have a shopping cart, then migrate that to the
authenticated user
If anonProfile.Cart IsNot Nothing Then

If Profile.Cart Is Nothing Then
profile.Cart = New Test.Commerce.ShoppingCart()
profile.Cart.Items.AddRange(anonProfile.Cart.Items)
end if

anonProfile.Cart = Nothing
End If

ProfileManager.DeleteProfile(e.AnonymousID)
AnonymousIdentificationModule.ClearAnonymousIdentifier()

End Sub

</script>

'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.Web
Imports System.Web.Profile


Public Class ProfileCommon
Inherits System.Web.Profile.ProfileBase

Public Overridable Property Country() As String
Get
Return CType(Me.GetPropertyValue("Country"),String)
End Get
Set
Me.SetPropertyValue("Country", value)
End Set
End Property

Public Overridable Property City() As String
Get
Return CType(Me.GetPropertyValue("City"),String)
End Get
Set
Me.SetPropertyValue("City", value)
End Set
End Property


Public Overridable Property Cart() As mai.eCommerce.ShoppingCart
Get
Return
CType(Me.GetPropertyValue("Cart"),mai.eCommerce.ShoppingCart)
End Get
Set
Me.SetPropertyValue("Cart", value)
End Set
End Property

Public Overridable Function GetProfile(ByVal username As String) As
ProfileCommon
Return CType(ProfileBase.Create(username),ProfileCommon)
End Function
End Class
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top