One of the situations we encounter when we are developing is to define who should and who should not access the pages of SharePoint by default SharePoint has default methods to achieve access the pages, but we need to have users access the pages but not the entire page, so even if heard.
User needs to access the page content but may not update or add new content.
How do you access the form pages and not save content to SharePoint?
In the situation is very normal to happen and have to be very well thought out to learn in that situation is to be used, SharePoint has a control "SPSecurityTrimmedControl"to control access to controls that we consider important and should have permissions associated with SharePoint.
Configure access controls for SharePoint Permissions
Add reference the DLL, To use the control SPSecurityTrimmedControl**, you must perform the reference at the top of our page of SharePoint.
<% @ Register TagPrefix= "SharePointWebControls"Namespace ="Microsoft.SharePoint.WebControls"Assembly ="Microsoft.SharePoint, Version = 126.96.36.199, Culture = neutral, PublicKeyToken= 71e9bce111e9429c "%>
Tag to limit the controlthe means permissions for SharePoint.
To limit access to our checks we should add tag SPSecurityTrimmedControl and PermissionsString, all controls that are within the tag are attached to permission Sharepoint, if no permission can not access.
<SharePointWebControls: SPSecurityTrimmedControl ID = "AgendaPermission" runat= "server" PermissionsString= "addListItems"><asp: TextBox runat= "server" id = "TextBox1"> </asp: TextBox><br><br><asp: Button runat= "server" Text = "Save"id =" Button1 "> </asp: Button></SharePointWebControls: SPSecurityTrimmedControl>
Here is List of Permissions in SharePoint.
When the page is in anonymous access or user that does not have permission "addListItems" controls within the tag "SPSecurityTrimmedControl"are not visible.
When you access our site with a user with permission to set the PermissionsString, you already can access the control, easy easy.
With this technique we can define several states and permissions associated with the user permissions using SharePoint.
I hope you enjoyed it