ASP.NET MVC如何指定文件夹的视图页面居住在? [英] ASP.NET MVC How to specify which folder the View pages reside in?

查看:85
本文介绍了ASP.NET MVC如何指定文件夹的视图页面居住在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,ASP.NET MVC引擎搜索下列文件夹浏览网页:

by default the ASP.NET MVC engine searches the following folders for View pages:


  • /查看/ {} CONTROLLER_NAME / {}行动的.aspx

  • /查看/ 共享 / {}行动的.aspx

  • /Views/{Controller_Name}/{Action}.aspx
  • /Views/Shared/{Action}.aspx

但是我希望把我的一些View页面是这样的:


  • /查看/ {命名空间} / {} CONTROLLER_NAME / {}行动的.aspx

  • /Views/{Namespace}/{Controller_Name}/{Action}.aspx

我怎样才能让引擎查找此?

How can I let the engine look for this?

推荐答案

您必须创建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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆