Ami*_*ari 5 c# asp.net-mvc asp.net-mvc-routing razor
one of my controller could not load "Index".for example :
http://localhost:51638/Reserve/
Run Code Online (Sandbox Code Playgroud)
doesn't work.but http://localhost:51638/Reserve/Index works.
and this problem is just for one of my controller and other is correct.
and my RouteConfig is:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// BotDetect requests must not be routed
routes.IgnoreRoute("{*botdetect}",
new { botdetect = @"(.*)BotDetectCaptcha\.ashx" });
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "UserHome", action = "Index", id = UrlParameter.Optional }
);
}
Run Code Online (Sandbox Code Playgroud)
after delete the controller and add Controller again it wasn't fix. and encounter to this error page:
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
and this is my Controller Code
public class ReserveController : Controller
{
//
// GET: /Reserve/
public ActionResult Index()
{
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
如果您有名为Reserve Controller 的控制器和名为Reserve的目录,则路由将转到该目录,除非您提供完整路由。这就是您收到 403.14 错误的原因。
因此,更改控制器或目录的名称。
| 归档时间: |
|
| 查看次数: |
907 次 |
| 最近记录: |