try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
foreach (SPGroup grp in currentWeb.CurrentUser.Groups)
{
if (grp.ID == 4)
{
writer.Write("User Logged in is an Administrator");
break;
}
if (grp.ID == 6)
{
writer.Write("User Logged in is an Contributor");
}
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
foreach (SPGroup grp in currentWeb.CurrentUser.Groups)
{
if (grp.ID == 4)
{
writer.Write("User Logged in is an Administrator");
break;
}
if (grp.ID == 6)
{
writer.Write("User Logged in is an Contributor");
}
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
No comments:
Post a Comment