Basically what the title says. I created a new MVC application. I'm trying to add new pages to the site, but anytime I do I get the following error:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Products
Here is my controller, called ProductsController.
namespace MyAppMVC.Controllers
{
public class ProductsController : Controller
{
public ActionResult Index()
{
return View("Index");
}
}
}
I had also tried
return View();
But that didn't work.
My view is called Index.aspx, and it's in the folder Views/Products.
So everything looks fine to me, I looked in the NerdDinners tutorial and they don't seem to do anything different than me either. I've looked at the home controller that comes with the app, and mine seems identical. I'm pretty sure I don't have to add anything to the routing, but maybe I do.
Any ideas? This has got me stumped.
As per request here is my global.asax.cs file
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}