Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2007, 07:05 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default question about profile and global.asax

Hi,

i'm trying to transform an anonymous user profile to an authenticated user profile, like chapter 13 of the book ASP.NET.

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


<%@ 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.ClearAnonymousIdenti fier()

    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.Sh oppingCart)
        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





 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM
global.asax ashokparchuri ADO.NET 1 February 25th, 2005 08:40 AM
An Error in Global.asax! Action BOOK: ASP.NET Website Programming Problem-Design-Solution 5 December 23rd, 2004 12:42 AM



All times are GMT -4. The time now is 07:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.