string strUserName = "kevin";
SPSite siteCollection = SPControl.GetContextSite(Context);
siteCollection.AllowUnsafeUpdates = true;
SPWeb web = siteCollection.AllWebs["testByjason10"];
web.AllowUnsafeUpdates = true;
SPRoleCollection rols = web.Roles ;
foreach(SPRole r in rols)
{
Response.Write (r.Name);
}
SPRole designerRole = web.Roles["Contributor"];
designerRole.AddUser("RELEASE-SERVER\\"+strUserName,"123@123.com","RELEASE-SERVER\\"+strUserName,"kevin");
SPSite siteCollection = SPControl.GetContextSite(Context);
siteCollection.AllowUnsafeUpdates = true;
SPWeb web = siteCollection.AllWebs["testByjason10"];
web.AllowUnsafeUpdates = true;
SPRoleCollection rols = web.Roles ;
foreach(SPRole r in rols)
{
Response.Write (r.Name);
}
SPRole designerRole = web.Roles["Contributor"];
designerRole.AddUser("RELEASE-SERVER\\"+strUserName,"123@123.com","RELEASE-SERVER\\"+strUserName,"kevin");