I am trying to validate the group at the time of login, have used runwithelevated but still I get an error on "SPGroup managerGroup = Web.Groups["DevTest"];" That the page is not accessible. How can I get beyond this. If I run the same code once I'm logged in, this runs fine, but I'm trying to validate this at the time of login.
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() {
using (SPSite CurrentSite = new SPSite(site.ID))
{ using (SPWeb CurrentWeb = CurrentSite.OpenWeb(web.ID))
{SPGroup managerGroup = Web.Groups["DevTest"];
bool isManager = CurrentWeb.IsCurrentUserMemberOfGroup(managerGroup.ID);
if (true)
{
Response.Redirect("~/sitepages/createrequest.aspx");
}
else
{
Label1.Text = "wrong user id or password";
}
}
}