我正在开发使用Visual Studio 2010的MVC3应用程序。MVC3中的Aspx页面
我有一个aspx页面,我想显示控制器操作的结果。
我将此操作添加到家庭控制器。
// GET: /Home/EmployeePortal
public ActionResult EmployeePortal()
{
return View();
}
这是aspx页面。
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>EmployeePortal</title>
</head>
<body>
<asp:TextBox ID="TextBox1" runat="server" />
<div>
This is employee portal
</div>
</body>
</html>
当我运行应用程序,我可以使用url导航到该页面: http://localhost:3990/Home/EmployeePortal
的问题是 - 当我有aspx页面上的一个或多个服务器端控制,我在网站上遇到这个错误。 很抱歉,处理您的请求时发生错误。
当我从页面注释掉服务器端控件时,它显示正常。
aspx页面通过添加新视图菜单作为视图添加到应用程序中。
我需要一个aspx页面集成到MVC应用程序,这就是为什么我试图使用这个aspx页面。
我不知道我在做什么错。请帮忙。
如果必须与传统的服务器控件等个别aspx页面简单的方法,你为什么与MVC? – Maess
MVC的重点在于你没有服务器端控件。在这里阅读http://beta.asp.net/mvc –