开发者

.net MVC 2 controller inheritance

开发者 https://www.devze.com 2023-04-09 20:16 出处:网络
I have i little problem with inheritance of my controllers for example : public class AController: Controller {

I have i little problem with inheritance of my controllers for example :

public class AController: Controller {
 public ActionResult Index(long id)
        {
            return Index(id, isComposite);
        }
}
public class BController : AController {


}

when i click on ..开发者_运维问答/B/Index/12 i get following exception : the view 'Index' or its master was not found. The following locations were searched: ~/Views/B/Index.aspx I can copy Index.aspx into "Shared" map but may be there is other workaround ? Thanks .


You could put it in ~/Views/Shared/Index.aspx but in ASP.NET MVC it is better to avoid such type of controller inheritance.

0

精彩评论

暂无评论...
验证码 换一张
取 消