Skip to main content

Posts

Showing posts from June 25, 2018

ASP.NET MVC Learning 2 : Routing Basics

ASP.NET Routing in ASP.NET MVC  is the concept of mapping the incoming request (URL) with the existing resources  For Example :  The incoming request URL for a local application is http://localhost:2233/home/index In the Application say we have configured the routing as "{controller}/{action}/{id}", so Home is the controller here and index is the action here, the id is optional in most cases, if id is not given then it will display the default value In ASP.NET MVC the controllers should have the naming convention, in this case the controller's name should be Home Controller, should end with 'Controller' suffix. The Routing mechanism looks in the HomeController for the Action that we set already, Here Home is Controller and the Action is Index In the Home Controller we will return the View (That is Index) as Action Result Sample Home Controller public class HomeController : Controller { public ActionResult Index ( ) { return V