i have given permission only read only to Users Group.so there are not access to see listitem or any list.
i have create application page with SPGridview with bind listitem.
this page access by this Group.
problem is that when i write code with supertoken like this :
SPSite SiteInUserContext = SPContext.Current.Site;
SPWeb webInUserContext = SPContext.Current.Web;
Guid webGuid = webInUserContext.ID;
Guid siteGuid = SiteInUserContext.ID;
var user = webInUserContext.AllUsers[@"SHAREPOINT\SYSTEM"];
var superToken = user.UserToken;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteGuid, superToken))
{
//my code
}
});
its throwing access denied of login User.
but when i write below code :
SPSite SiteInUserContext = SPContext.Current.Site;
SPWeb webInUserContext = SPContext.Current.Web;
Guid webGuid = webInUserContext.ID;
Guid siteGuid = SiteInUserContext.ID;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteGuid)
{
//my code
}
});
user can able to access this page with Gridview as well as also edit,add new item in to listitem.
My doubt is in Which Situation We use SuperUserToken with SPSecurity.RunWithElevatedPrivileges in Sharepoint object model.

