ASP.NET MVC 如何指定查看页面所在的文件夹? [英] ASP.NET MVC How to specify which folder the View pages reside in?
本文介绍了ASP.NET MVC 如何指定查看页面所在的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认情况下,ASP.NET MVC 引擎在以下文件夹中搜索查看页面:
by default the ASP.NET MVC engine searches the following folders for View pages:
- /Views/{Controller_Name}/{Action}.aspx
- /Views/共享/{Action}.aspx
- /Views/{Controller_Name}/{Action}.aspx
- /Views/Shared/{Action}.aspx
但是我想把我的一些视图页面像这样:
- /Views/{Namespace}/{Controller_Name}/{Action}.aspx
- /Views/{Namespace}/{Controller_Name}/{Action}.aspx
如何让引擎寻找这个?
推荐答案
你必须创建一个从 IViewEngine 接口派生的类,并在 Global.asax.cs 的 Aplication_Start 事件中注册这个类检查此链接文本,但是和1.0有一些区别
You have to create a class derived from IViewEngine interface and register this class in Aplication_Start event in Global.asax.cs Check this link text, but there are some differences with 1.0
这篇关于ASP.NET MVC 如何指定查看页面所在的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文