将asp.net网站与asp.net MVC混合使用

时间:2022-07-16 01:40:33

i am having an asp.net web site and in that in the app_Code folder I have created a folder call Areas and Created CommonEOS Area and added the MVC controller,views and models to it.

我有一个asp.net网站,在app_Code文件夹中,我创建了一个文件夹调用区域和创建的CommonEOS区域,并添加了MVC控制器,视图和模型。

In the controller I get the error cannot resolve index for the view

在控制器中我得到的错误无法解析视图的索引

How To solve this. The controller code is

如何解决这个问题。控制器代码是

Function About() As ActionResult
 Return View() //<== I get cannot resolve here.
End Function

2 个解决方案

#1


1  

You can try with this approach for the views locator:

您可以尝试使用此方法进行视图定位器:

A Custom View Engine with Dynamic View Location

具有动态视图位置的自定义视图引擎

#2


0  

You should have your views in the Views folder if you to follow MVC conventions. You can also create an Area, but you should follow the conventions for creating Areas (registering, etc) or take advantage of the tooling to create new areas.

如果要遵循MVC约定,您应该在Views文件夹中拥有您的视图。您也可以创建区域,但是您应该遵循创建区域的约定(注册等)或利用工具创建新区域。

If you don't want to follow convention, you must explicitly tell MVC where to find the view.

如果您不想遵循约定,则必须明确告诉MVC在何处查找视图。

#1


1  

You can try with this approach for the views locator:

您可以尝试使用此方法进行视图定位器:

A Custom View Engine with Dynamic View Location

具有动态视图位置的自定义视图引擎

#2


0  

You should have your views in the Views folder if you to follow MVC conventions. You can also create an Area, but you should follow the conventions for creating Areas (registering, etc) or take advantage of the tooling to create new areas.

如果要遵循MVC约定,您应该在Views文件夹中拥有您的视图。您也可以创建区域,但是您应该遵循创建区域的约定(注册等)或利用工具创建新区域。

If you don't want to follow convention, you must explicitly tell MVC where to find the view.

如果您不想遵循约定,则必须明确告诉MVC在何处查找视图。