i tried creating aspnetb users in moss 2007 user profiles ,but i received a
error
"The trust relationship between the primary domain and the trusted domain
failed".
The code used was
string username =
WebConfigurationManager.AppSettings["ImpersonationUsername"].ToString();
string password =
WebConfigurationManager.AppSettings["ImpersonationPassword"].ToString();
string domain =
WebConfigurationManager.AppSettings["ImpersonationDomain"].ToString();
WindowsImpersonationContext wic = CreateIdentity(username, domain,
password).Impersonate();
string url = SPControl.GetContextWeb(Context).Url;
SPSite _SPSite = new SPSite(url);
SPWeb spWeb = _SPSite.OpenWeb();
string currentUser = spWeb.CurrentUser.Name;
ServerContext serverContext = ServerContext.GetContext(_SPSite);
UserProfileManager userProfileManager = new UserProfileManager(serverContext);
UserProfile userProfile =
userProfileManager.CreateUserProfile(txtUserName.Text.Trim());
userProfile["Segment"].Value = txtSegment.Text.Trim();
userProfile["WorkEmail"].Value = txtEmail.Text.Trim();
userProfile["PreferredName"].Value = txtPreferredUserName.Text.Trim();
userProfile.Commit();
wic.Undo();
This is the code which is available on msdn .I was trying to add user through a
webpart
Do you know someone who can help? Share a link to this thread on twitter, or facebook.