Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

namespaces - ASP.NET MVC How to specify which folder the View pages reside in?

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

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

However I want to put some of my View pages like this:

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

How can I let the engine look for this?

question from:https://stackoverflow.com/questions/799838/asp-net-mvc-how-to-specify-which-folder-the-view-pages-reside-in

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...