如何禁用内置果园控制器操作 [英] How to disable build-in orchard controller action
问题描述
我想知道,有没有办法从Orchard框架中禁用控制器操作?
I would like to know, is there a way to disable a controller action from the Orchard framework?
我已经创建了一个自定义注册控制器,并且我想覆盖内置的/Users/Account/Register操作.我不知道如何解决这个问题;框架内有路由注册,也许我可以以某种方式覆盖路由?
I have created a custom registration controller and I would like to override the built-in /Users/Account/Register action. I don't know how to solve this issue; there are route registrations within the framework, maybe I could override the routes somehow?
推荐答案
有两条路线.
1)实现您自己的控制器,并取代原始的Accounts Controller(将下面列出的名称空间替换为正确的名称空间.这就是我们的项目所要做的(我们有单独的身份验证系统
1) Implement your own controller and supress the original Accounts Controller (substituting the namespace listed below with the correct one. This is what our project does (we have a separate authentication system
[OrchardSuppressDependency("Orchard.Tags.Controllers.HomeController")]
public class HomeController : Controller {
//my controller implementation
}
2)在模块中使用自己的路由定义定义IRouteProvider(到其他完全独立的控制器/动作).您可以在本文的添加路线"部分中看到概述的内容 http://docs.orchardproject.net/Documentation/Building-a-hello-world-module
2) Implement IRouteProvider in your module with your own definition for that route (to some other completely separate controller/action). You can see that outlined in the "Adding a Route" section of this article http://docs.orchardproject.net/Documentation/Building-a-hello-world-module
如果您不打算替换整个身份验证,则选项2可能会更好
Option 2 is probably better if you don't intend to replace the entire of authentication
这篇关于如何禁用内置果园控制器操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!