0
public class BookController : Controller
{
public ActionResult Show(int bid)
{
return View();
}
}
routes.MapRoute(
name: "Show",
url: "Book/{bid}/",
defaults: new {controller = "Book", action = "Show"},
constraints: new {bid = @"\d+"}
);
/電子書/測試/
它會返回500錯誤,如何返回404錯誤?
如果路由器不匹配,如何返回404?
試試這裏:http://stackoverflow.com/questions/553922/custom-asp-net-mvc-404-error-page –