- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目的是什么,什么时候应该使用 SurfaceController 和 RenderMvcController?似乎我无法用 SurfaceController 做任何事情,而我不能用 RenderMvcController 做任何事情。例如,我正在专门考虑处理表单提交。使用 RenderMvcController 我可以:
public class HomeController : RenderMvcController
{
private IUmbracoMapper _umbracoMapper;
public HomeController()
{
_umbracoMapper = new UmbracoMapper();
}
[HttpGet]
public ActionResult Home()
{
HomeViewModel viewModel = new HomeViewModel();
_umbracoMapper.Map(CurrentPage, viewModel);
return CurrentTemplate(viewModel);
}
[HttpPost]
public ActionResult Home(HomeViewModel viewModel)
{
// Handle form submission
}
}
最佳答案
来自官方文档:
表面 Controller
A SurfaceController is an MVC controller that interacts with the front-end rendering of an UmbracoPage. They can be used for rendering Child Action content, for handling form data submissions and for rendering Child Action macros. SurfaceControllers are auto-routed meaning that you don't have to add/create your own routes for these controllers to work.
By default all of the front end routing is executed via the Umbraco.Web.Mvc.RenderMvcController Index Action which should work fine for most people. However, in some cases people may want complete control over this execution and may want their own Action to execute. Some reasons for this may be: to control exactly how views are rendered, custom/granular security for certain pages/templates or to be able to execute any custom code in the controller that renders the front end. The good news is that this is completely possible. This process is all about convention and it's really simple!
关于Umbraco SurfaceController 与 RenderMvcController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27515659/
目的是什么,什么时候应该使用 SurfaceController 和 RenderMvcController?似乎我无法用 SurfaceController 做任何事情,而我不能用 RenderMv
所以我正在使用 Umbraco 6.12 并且很难测试 RenderMvcController . 我已经实现了IApplicationEventHandler在我的Global.ascx并且 Nin
我对 Umbraco 有疑问。可能是我对 Umbraco 的工作原理缺乏一些基本的了解。 设置 一个有效的 Umbraco 7.2.8 安装 文档类型:学校和论坛 结构:论坛在内容树中属于学校。 继承
我在 Umbraco 中设置了文档类型,并为此文档类型创建了自定义 Controller 和模型。 自定义 Controller 继承自:RenderMvcController类和 View 通过 @
嗨,我在 umbraco 7 中有一个“home” Controller 和一个“sort” Controller 。“home” Controller 对于索引操作工作得很好,因为它被 Render
我是一名优秀的程序员,十分优秀!