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...
}
SPUser user = SPContext.Current.Web.CurrentUser;
if (user == null || string.IsNullOrEmpty(user.LoginName))
{
Response.Redirect(SPContext.Current.Web.Url, true);
}
else
{
//your code here...
}
Nice... Thanks...
ReplyDelete