你能发布你的控制器文件和你的视图文件吗?
这行得通;
MytestController--------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
namespace testapp.Controllers
{
[ValidateInput(false)]
public class MyTestController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
我的测试(索引)---------------------------------------------- ---------
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Index</title>
</head>
<body>
<% using (Html.BeginForm()) { %>
<%= Html.TextBox("test")%>
<button type="submit" >Submit</button>
<%} %>
</body>
</html>