文件路径:views/show/test/Index.aspx控制器为: public class TestController : Controller
{
public ActionResult Index(string id)
{
ViewData["chsword"] = id;
return View();
} }路由为: routes.MapRoute(
"Default", // 路由名称
"show/{controller}/{action}/{id}" // 带有参数的 URL
new { controller = "Test", action = "Index", id = UrlParameter.Optional } // 参数默认值
);
最后访问,http://127.0.0.1/show/Test/Index/9,提示未找到视图,这种有几层文件夹的,要如何来写呢?谢谢!!
{
public ActionResult Index(string id)
{
ViewData["chsword"] = id;
return View();
} }路由为: routes.MapRoute(
"Default", // 路由名称
"show/{controller}/{action}/{id}" // 带有参数的 URL
new { controller = "Test", action = "Index", id = UrlParameter.Optional } // 参数默认值
);
最后访问,http://127.0.0.1/show/Test/Index/9,提示未找到视图,这种有几层文件夹的,要如何来写呢?谢谢!!
new { controller = "Test", action = "Index", id = UrlParameter.Optional } 不知道执行没有执行这个路由。还没遇到过类似的情况
就是加多个文件夹views/show/test/Index/9 ,
在路由里url样式加上 :
"show/{controller}/{action}/{id}" ,
new { controller = "Test", action = "Index", id = UrlParameter.Optional },
就找不到路径了