Friday 24 September 2010

Userprofile picture through SSL

I have written an advanced contact web part. This web part shows the details of an user that is contactperson for that specific site. One of the options is showing the profile picture. Through the intranet it works fine. Through the extranet (which is available via SSL) it didn't work.

In the web part, I store the accountname of the user. When showing the web part, I will retrieve the details from the user profile, using the UserProfileManager and UserProfile (namespace: Microsoft.Office.Server.UserProfiles). The properties of the user are gotten from the property collection.
One of the properties is the "PictureUrl". I was assuming those url was server relative, but unfortunately it isn't. So I overcome this problem to create a Uri object, based on the retrieved PictureUrl and uses from that Uri object the PathAndQuery property. Using this value as an url for the image tag works perfectly fine.

No comments: