Reputation: 18765
ASP.NET profile properties are trivially available to the code-behind of an ASPX web page courtesy of the HttpContext.Current.Profile
object.
In a .svc
web service, how does one bring ProfileCommon and paraphernalia into scope?
Upvotes: 1
Views: 950
Reputation: 25
The usual way I use for accessing profile data via classes in App_Code folder within a web app worked for me:
MembershipUser mu = Membership.GetUser(userName, false);
ProfileCommon p = (ProfileCommon)ProfileBase.Create(mu.UserName, true);
Upvotes: 0
Reputation: 18765
In the web.config
file is a commented out section controlling whether the profile service is enabled. Enabling it changes the generated code and HttpContext becomes available.
You don't have the class that descends from ProfileBase to present profile properties as strongly typed properties. This however is hardly a disaster, you just use
HttpContext.Current.Profile.GetPropertyValue(string propName)
and cast the result.
Upvotes: 3