Resource not found (bug in ASP.NET MVC 5)

I manually added a view to my home folder called "Test.cshtml".

When I opened this view in a browser, it shows me an error: Resource not found.

I tried the following solutions but still get this error:

1- Right click on "Project Name"> "Properties"> "Specific Page"> set it to "Home / Test".

2- In the RouteConfig class> RegisterRoutes method> Default MapRoute> set: controller = "Home", action = "Test".


source to share

2 answers

You need to add Action


to your controller Home


public class HomeController : Controller
    public ActionResult Test()
        return View();


Visual Studio

can help you create view for action, right click on method Test

andAdd View...

You can read more about routing and attribute routing in this MSDN article .

Also a good read - How Route URLs Are Matched



In my case, this is very strange. I am changing one action method in my controller to take 2 parameters instead of 4 as it was before, but forgot to update the ajax call to the view and caused this error.

Before: data: {officer: officer, "scid": scid, "timein": timein, "timeout": timeout} - raises an error due to parameter mismatch

Now: data: {officer: officer, "scid": scid} - now works fine.



All Articles