Restrict Anonymous users from accessing custom Admin pages

 Restrict Anonymous users from accessing custom Admin pages..Use this snippet in page load where you want to restrict... 

SPUser user = SPContext.Current.Web.CurrentUser;
                if (user == null || string.IsNullOrEmpty(user.LoginName))
                {
                    Response.Redirect(SPContext.Current.Web.Url, true);
                }
                else
                {
//your code here...

}

Comments

Post a Comment

Popular posts from this blog

Sharepoint 2013-Minimal Download Strategy.

Bulk update and delete using SPservice in SharePoint