|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
/// <summary>
/// Summary description for Helper
/// </summary>
public class UserHelper
{
public UserHelper()
{
}
public static void RemoveUser(string username)
{
try
{
System.Web.Security.Membership.DeleteUser(username);
}
catch
{
}
}
public static MembershipUser CreateUser(string username, string password, string rolename)
{
try
{
MembershipUser oMemberShipUser = (System.Web.Security.Membership.CreateUser(username, password));
System.Web.Security.Roles.AddUserToRole(username, rolename);
return oMemberShipUser;
}
catch (Exception)
{
}
return null;
}
public static void AddRole(string role)
{
try
{
System.Web.Security.Roles.CreateRole(role);
}
catch
{
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.