[英]MVC 3: Where can I find default templates for DisplayForModel and EditorForModel?
[英]Where can I find IController for MVC 6?
protected virtual IActionResult InvokeHttp404()
{
IController errorController = EngineContext.Current.Resolve<CommonController>();
var routeData = new RouteData();
routeData.Values.Add("controller", "Common");
routeData.Values.Add("action", "PageNotFound");
errorController.Execute(new RequestContext(HttpContext, routeData));
return new EmptyResult();
}
在新的Microsoft.AspNet.Mvc中,找不到IController,并且Execute不是IController的一部分。
没有一个- 控制器继承自ControllerBase 。
在您的方案中,您需要解析对CommonController
类型的CommonController
而不是IController
,您可以使用该引用直接调用您的action方法。 就像是;
CommonController errorController = EngineContext.Current.Resolve<CommonController>();
errorController.PageNotFound();
return new EmptyResult();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.