Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
Created November 9, 2015 01:11
Show Gist options
  • Select an option

  • Save RyanABailey/3586ed29ac69af9ff59b to your computer and use it in GitHub Desktop.

Select an option

Save RyanABailey/3586ed29ac69af9ff59b to your computer and use it in GitHub Desktop.
Sitecore User Registration
private static string Domain = "extranet";
public static void RegisterUser(string firstName, string lastName, string email, string password)
{
var userName = string.Format(@"{0}\{1}", Domain, email);
try
{
if (!Sitecore.Security.Accounts.User.Exists(userName))
{
Membership.CreateUser(userName, password, email);
// Edit the profile information
Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName(userName, true);
Sitecore.Security.UserProfile userProfile = user.Profile;
userProfile.FullName = string.Format("{0} {1}", firstName, lastName);
}
}
catch (Exception ex)
{
// log error
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment