Hi Fred,
I think I am a bit thick today as it only occurred to me now what the problem is.
You're writing code in the App_Code folder, where stuff like Profile isn't available by default. However, there are at least two work arounds:
1. Have your function in Helpers accept a Profile object:
Public Shared Sub DoSomethingUseful(ByVal myProfile As ProfileCommon)
' Here, myProfile.Address is now available
End Sub
You can now call the Sub in an ASPX pgae like this:
Helpers.DoSomethingUseful(Profile)
2. If you can't or don't want to pass references to the Profile object, you can get one in app code like this:
Public Shared Sub DoSomethingUseful()
Dim myProfile As ProfileCommon = CType(ProfileBase.Create(Membership.GetUser().User Name), ProfileCommon)
' Now, myProfile.Address is now available
End Sub
Although the name Create implies it creates a nw Profile, you actually get the one for the user retrieved by Membership.GetUser().
Does this help?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.