Login

How do I implement user registration in 4.20 and earlier?

Versions: 4.20, FAQ number: 46, Old FAQ number: 972

Q: If you would allow users to create their own accounts and just have to enter username and password, it feels unnecesary to show EPiServer.Util.ExtranetForm. Is there another way to create users without showing every unnecesary fields?

A: Yes there is another way, try the following code:

// Create user
 ExtranetForm form = new ExtranetForm();
 PropertyDataCollection props = form.Propertys; 
 props["UserName"].Value = name; 
 props["PassWord"].Value = pass; 
 props["Email"].Value = mail; 
 props["Active"].Value = true; 
 int[] defaultGroup = new int[1]; 
 try 
 {
  defaultGroup[0] = Int32.Parse(Global.EPConfig["EPnDefaultGroup"].ToString());
 }
 catch(Exception){}

EPiTrace logger