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.