I have created asp.net empty project in visual studio 2013 with c#. So whenever I tries to get any view I get error of Resource not found. However, If I create a internet application template project it works fine.
So here is my URL: http://localhost:43763/Home/About
Home Controller (Home.cs)
namespace MvcApplication1.Controllers
{
public class Home : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
return View();
}
}
}
About View (About.cshtml)
@{
ViewBag.Title = "About";
}
<h2>About</h2>
Here is RouteConfig.cs
namespace MvcApplication1
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}