xyz777
xyz777

Reputation: 67

ASP.NET MVC changed view name

I changed the name of view files (Index.cshtml -> Performance.cshtml), and when I execute the project, the application can't recognise the new view name. I changed the name of an action in controller accordingly (ActionResult Index() -> ActionResult Performance()). However, it keeps saying HTTP 404 error.

Upvotes: 0

Views: 2571

Answers (2)

Harshil Shah
Harshil Shah

Reputation: 203

When you change your view name mvc application can't find a proper view for it's controller action method.

If it is your default page view( load on application start) than you also need to make changes in your Route_config file.
See the image below enter image description here Change controller = " Name_of_controller" & action="name_of_action" in your case action name will be Performance.
Always Remember in mvc you can run any method using browser url
for example : controller is home & method is Performance than url will be localhost:port/home/Performance

Upvotes: 1

Rocker1985
Rocker1985

Reputation: 312

Change the default route defined in App_Start/RouteConfig.cs file to set Performance as the default action.

Or, you can run the project with the following URL:http://localhost:port/home/Performance

Upvotes: 1

Related Questions