I need a "Profile_MigrateAuthenticated" event - ASPNET 2.0

  • Thread starter Thread starter alain.hogue
  • Start date Start date
A

alain.hogue

I known that by using the "Profile_MigrateAnonymous" event I can
migrate my anonymous users profile to their authenticated account
profile, but I would like to carry over some of the properties of their
authenticated account profile back to anonymous profile when they
logout.

How can I do that?

Thanks !
 
Hmm, that's sort of hard, since you're not sure when they logout, especially
if it's simply due to cookie timout (meaning they don't make a request to
the server, yet they timeout and thus arelogged out). If this is an absolute
requirement, then you probabaly should keep the anon profile in synch with
the logged in profile when updates are necessary tot he logged in profile.
Sounds icky, though :(

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Thanks for your help. Something you said about synchronizing helped me
solve my problem. Have an Happy New Year !!!

Public MustInherit Class MyPage
Inherits System.Web.UI.Page

Protected MustOverride Function GetProfile() As ProfileCommon

Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)
Dim currentProfile As ProfileCommon = Me.GetProfile

If currentProfile.IsAnonymous Then
If Not Me.Session("Username") Is Nothing Then
Dim userProfile As ProfileCommon =
currentProfile.GetProfile(Me.Session("Username"))

currentProfile.PreferredTheme =
userProfile.PreferredTheme
currentProfile.PreferredCulture =
userProfile.PreferredCulture
currentProfile.Save()

Me.Session.Remove("Username")
End If
Else
If Me.Session("Username") Is Nothing Then
Me.Session("Username") = currentProfile.UserName
End If
End If

Me.Theme = currentProfile.PreferredTheme

MyBase.OnPreInit(e)
End Sub
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

Back
Top