Posts

Showing posts from September, 2013

Hide Ribbons to the anonymous users

Hide Ribbons to the anonymous users in SharePoint based on the  PermissionsString  ...... <SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server"         PermissionsString="AddListItems" AuthenticationRestrictions="AuthenticatedUsersOnly">        <script type="text/javascript">             document.getElementById("s4-ribbonrow").style.display = "block";             document.getElementById("suiteBar").style.display = "block";             /*document.getElementById("Span1").style.display = "block";*/         </script>     </SharePoint:SPSecurityTrimmedControl>

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... }