摘要
MVC是当前广泛使用一种软件开发模式。将应用程序分为三个主要的组件:Modal(模型),View(视图)和Controller(控制器),Modal用来存放数据和操作数据,View用来设计用户界面,Control用来接收和处理用户请求,并和模型和视图建立联系,其中控制器是核心。控制器中可以定义一些动作(Action)来处理用户的请求,在动作前可添加自定义授权过滤器来验证用户请求的合法性。通过定义以AuthorizeAttribute为父类的子类,来设计授权规则。用户登录时,根据用户的登录身份信息给用户进行授权,如果授权失败,则用户不能执行后续的操作,从而达到强制用户登录的目的。
MVC is a widely used software development model.The application is divided into three major components: Modal(model),View(view) and Controller(controller),Modal is used to store data and manipulate data. View is used to design user interfaces, and Control is used to receive and process user requests, and it builds relationships with models and Views.A number of actions can be defined in the controller(Action) to handle user requests.A custom authorization filter can be added before the action to validate the validity of the user request.By defining a subclass of Authorize Attribute design authoriddddzation rules.When a user logs in, the user is authorized. If the authorization fails, the user cannot perform subsequent operations..The user must log in before he can operate it.
出处
《信息通信》
2017年第12期136-138,共3页
Information & Communications
基金
2016年度江西省教育厅科学技术研究项目编号:GJJ161346<高职ASP.NET(C#)课程"全真"项目化教学模式的研究与实践>