ASP. NET Common permission verification component implementation, asp.net permission
Sofa (SF) General permission verification component
Opening
This article introduces the implementation code of general permission verification, which includes importing parameters, parsing XML, processing according to XML configuration, and returning results.
Code Architecture
1.Class Introduction
1. SFWebPermission: implements the IHttpModule interface and permission verification portal;
2. SFConfig: Import XML configuration class;
3. SFPermission: Parse XML configuration for permission verification;
4. SFAccessOper: database operation class;
5. SFPermissionSQL: XML node entity class;
6. SFParameter: XML node entity class;
7. SFCommon: System variable definition class;
8. SFConst: System constant definition class;
9. SFPermission. xml: configuration file. The format has been described in the previous article.
2.Code structure
Figure 1
Figure 2
The Algorithm Implementation of the code is the easiest to think of and the most commonly used encoding method. The advanced usage in the language has never been studied. It is certainly not used!
Permission verification is based on the primary key obtained through URL query. Therefore, the permission Project (menu) Table must have a URL column. We recommend that you add a corresponding table, assume that a permission item may need to correspond to multiple URL requests.
Using this component does not require any code modifications to the original project.
The code is developed under the. net2.0 framework and needs to be tested under the bin directory of the website;
Add
<HttpModules>
<Add name = "myHttpModule" type = "SFPermission. SFWebPermission, SFPermission"/>
</HttpModules>
If an error occurs, add the following content under the <system. webServer> node.
<Modules>
<Add name = "myHttpModule" type = "SFPermission. SFWebPermission, SFPermission"/>
</Modules>
DLL: http://files.cnblogs.com/shangfeng/%E6%B2%99%E5%8F%91%28SF%29%E9%80%9A%E7%94%A8%E6%9D%83%E9%99%90%E9%AA%8C%E8%AF%81%E7%BB%84%E4%BB%B6.rar
C # aspnet B/S version general software management system rapid development architecture source code
I have. Contact us at night.
Question about the net common permission management component
Some systems require complex components to set permissions. For example, the logging function is also available in the system. You can write SQL records by yourself. You can also use log4net. Of course, the latter is much more troublesome and requires many configuration items, however, the function is very powerful. The same applies to general permission management.
In the end, it depends on your own needs.