HttpModule
Working principle
HttpModule is responsible for monitoring the HttpRequest, when an HTTP request arrives at HttpModule, the entire ASP. NET Framework system does not do any processing of this HTTP request, that is, at this point, we do the right to judge, If there is no relevant permission-oriented jump page.
Create HttpModule and Deploy
1. Open Visual Studio 2013 (you can of course use any version of VS that you installed) and choose to create a new project, such as:
2. Select "ASP. NET Web Application" in the Visual C # node, such as:
3. Select an empty template, then click OK, such as:
4. Create a new project in project, select the ASP., enter a name, click Add, such as:
5. In the new HttpModule project, a new event is added within the Init method (this event is executed when all request is completed), such as:
6, in the newly added method, add our judgment of the code, I test the view address here is/sites/jianyu/doclibrary/forms/allitems.aspx, if the current user conforms to the rules, do not do any processing, otherwise jump to the page without permission. Of course, remember to quote MicroSoft.SharePoint.dll this file;
7, of course, but also to create a jump page, we go to the page library, we see only a page can not find the time to access the page, we add a page without permission, such as:
8, click on the Ribbon menu above files inside new Document, select page, such as:
9, fill in the title and URL Name, and then select the page layout of the Jump page, click Create, such as:
10, after the creation, go to the page library, find the page we created, edit properties, such as:
11, find the Jump URL attribute, fill in the home address, such as:
12, and then see this page has been created, if necessary, can be modified, such as:
13. The next step is to deploy HttpModule and find the Web. config for our application, such as:
14. Find the Web. config to add our HttpModule registration information, such as:
15, the production of DLL files, deployed to the port under the Bin directory, such as:
16, through the browser tool, you can see the process of page jump, such as:
Summary
Of course, I this permission to judge relatively simple, if you need to be responsible for the rights management, you can design a list of permissions, used to manage the page and users and groups can, this is relatively simple, hehe.
is a relatively simple HttpModule app on SharePoint, SharePoint itself is Net-based, and there may be a lot of net development methods that can be applied to SharePoint to facilitate our development.
SharePoint 2013 Manage View permissions through HttpModule