Asp.Net MVC Action methods and URLs

Here we will learn what are the action methods in mvc and how to define urls for action method in mvc with example.

Action Methods & Urls in Asp.Net MVC

Let’s start understanding what Action method is? when any user want to access website or application in mvc user enter URL in browser like as shown below


E.g.  http://localhost:7575/PersonDetails/Index


In above URL you can see that PersonDetails is controller and Index is action method which user is entering to invoke action method index by enter this URL in browser.


/PersonDetails/Index PersonDetails Index  

 When controller gets request by browser that controller will invoke method inside it . In case if method not found in controller then it will popup error saying http not found exception.

Controller with Action Methods in Asp.Net MVC 

The method with ActionResult in mvc is called as Action Methods which return various View Results. For example following is the PersonDetailsController code snippet. You will see that Controller is a Class and Index is a Method in side that class. Here Index is the action method of PersonDetailsController


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;

using Tutorial3.Models;


namespace Tutorial3.Controllers


public class PersonDetailsController : Controller



// GET: /PersonDetails/


public ActionResult Index()


return View(newPerson());




This is how we can define action methods and urls for action methods in mvc application.

Topics Covered