Here is a little sample
public static bool IsAnnonymous(this SPUser user)
{
return user == null || String.IsNullOrEmpty(user.LoginName);
}
public static void IsUserAnnonymous(this SPUser user)
{
if (user.IsAnnonymous())
{
// In Case the user is annonymous then redirect to AccessDenied.aspx Page
response.Redirect("/_layouts/AccessDenied.aspx", true);
}
}
You can call the method by
IsUserAnnonymous(SPContext.web.Current.User);
Ads by Google
No comments:
Post a Comment