...

/

View Search Path Convention and Logging

View Search Path Convention and Logging

Learn about the ASP.NET Core MVC's view search path convention and demonstrates logging in the HomeController's Index method.

The view search path convention

The Index and Privacy methods are identical in implementation, yet they return different web pages. This is because of conventions. The call to the View method looks in different paths for the Razor file to generate the web page. Let’s deliberately break one of the page names so that we can see the paths searched by default:

Step 1: In the Northwind.Mvc project, expand the Views folder and then the Home folder.

Step 2: Rename the Privacy.cshtml ...