In the format,
i - stands for Identity provider
f - stands for fba authentication
fbamembershipprovider - is my providername
Here you go, a simple sample that servers the pupose.
SPSite sitename = new SPSite("SiteURL");
SPWeb spWeb = sitename.OpenWeb();
String strusername= "i:0#.f|fbamembershipprovider|" + UsernameTextbox.Text;
spWeb.AllUsers.Add[strusername, EmailTextbox.Text, UsernameTextbox.Text, strusername];
if (spUser != null)
{
SPGroup spGroup = spWeb.Groups["GROUP_NAME"];
if (spGroup != null)
spGroup.AddUser(spUser);
}
Happy Coding :)
Thanks it helped a lot.
ReplyDelete