Search code examples
asp.netc#-4.0sqlprofileprovider

read user profile by username


I need to retrieve from the profile of some user (which is not the one is currently logged-in) by using the username

for example

<properties>
    <add name="StartedOn"/>
    <add name="FullName"/>
    <add name="Email"/>
    <add name="Phone"/>
</properties>

and I want to retrieve the FullName for other user than the currently logged one by using username for the desired one so what should i do


Solution

  • foreach (string name in q)
    {
         ProfileBase pb = ProfileBase.Create(name);
         string s = pb.GetPropertyValue("Fullname").ToString();
    }
    

    where q is query result using Linq