Mike Witt Mike Witt - 25 days ago 6
C# Question

Http 404 error on .cshtml file

I started getting a 404 error on one of my ASP.NET MVC cshtml file. Previously it had been found. What is really throwing me off is that, if I right click on any .cshtml file in Visual Studio 2013's Solution Explorer and choose to view in browser, I can see the results in the browser. But, if I right click on this one file and choose view in browser, I get a 404 error. Anyone know what gives?

Answer

Be sure that your URL is pointing to one valid MVC Route (Controller/Action).

In most cases, if the view can't be found it will be throw an error message with locations searched for it.