Reputation: 6441
I wonder mapping mechanism from controllers to views. I can not understand how mapping can be possible If we just return value of View() method. Controller class's View() method call overloaded View method with null parameters. But how can be possible to mapping to views with none specified returning value of View() method ?
Upvotes: 0
Views: 128
Reputation: 1039298
The controller knows the action that is being invoked and by convention if you don't specify a view name it will look in Views/ControllerName/ActionName.aspx
(.ascx
) for a corresponding view. If it doesn't find it will show you a list of searched locations.
Here are more details about how it works:
/ControllerName/ActionName
ControllerNameController
exists.Controller
in all referenced assemblies and those types are cached.Upvotes: 2
Reputation: 33318
The controller's action method is invoked by the ASP.NET MVC framework. The routing rules you have global.asax define which URL is mapped to which action method.
Upvotes: 1