I have a web part, hosted within a SharePoint 2007 site that has Forms Authentication enabled. During the registration process, I allow users to upload a profile image which gets stored within ASP Membership provider, but I need to add the image to the MOSS User profile as well.

After some research, I figured that this can be achieved through the MOSS UserProfile class but it can only be accessed through a server context.

I've added the requirements including Microsoft.Office.Server.dll to my application and have access to ServerContext, but regardless of how I try to access the context, it always comes back un-instantiated:

using (SPSite site = new SPSite("http://localhost:1999")
     ServerContext sc = ServerContext.GetContext(site);

I'm assuming this is because I'm running the web site through a local host instance and not a named instance?

Is there any other particular reason why the context would be null?

Edit: turns out that SSP was the issue, thanks Andreas.

  • Hi Andreas, no SSP is not enabled as I'm testing this on a localized instance of SharePoint. Figured I don't need to go through the hassle. is SSP an absolute MUST? why? – JadedEric Aug 8 '11 at 8:52
  • Can you accept @Andreas' answer? I updated it to be an answer instead of a comment. Sorry about the confusion. – Kit Menke Aug 11 '11 at 13:37

The SSP (Shared Service Provider) must installed and configured properly. You can create a new SSP through Central Administration.

  • I rephrased your answer here and added a link. Feel free to edit as you see fit. – Kit Menke Aug 11 '11 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.