.netasp.netwcfasp.net-membershipasp.net-profiles

ASP.net Membership and profiles in WCF


I'm working on a WCF service that requires Membership and Profile access.

I got the Membership stuff working by using System.Web.Security.Membership class and calling CreateUser() and ValidateUser() but i can't get the Profile to work. I don't even know what class to call, all the samples that i have seen are for ASP.net like the one i posted below,

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        txtFirstName.Text = Profile.FirstName;
        txtLastName.Text = Profile.LastName;
        int foo = Profile.Age;
    }
}

when i try that in my WCF endpoint the Profile object isn't available and I can't find any other way to access it.

can someone please point me to the write direction on how to access profile details?


Solution

  • I think this question covers your problem:

    Why was the Profile provider not built into Web Apps?

    I would try using the Web Profiler Builder mentioned in one of the answers - seems like something that could help you. An alternative would be to handcode a strongly typed wrapper around the profile in a way similar to the autogenerated one.