I'm searching for:
   
   

Richard
"No alarms and no surprises please"

My Blog



Accessing User Profile Outside Web Project
July 11, 2007

This is a little chunk of code that has escaped me for a little bit, but I finally was able to find enough resources to piece together how to do it.

If your using the new Profile Providers inside of .NET 2.0, here is how you can access a member's profile from outside the web project.  You don't get the strongly typed parameters but it still can come in handy if your desperate.

ProfileBase pb = ProfileBase.Create("UserName");
object obj = pb.GetPropertyValue("NameOfValueYouWantToGet");

of course you'll want to cast the object and check for it's existence.  It's only two lines of code but it can help you out in a pinch.  Turns out, after a few hours of figuring this out, I really didn't need it after all, but now I have it in my pocket in case I do.

Views: 10

Comments

No comments have been added to this blog. Why not be the first?