---
title: "What is the use of ActionName Attribute in asp.net MVC?"  
description: "What is the use of ActionName Attribute in asp.net MVC?"  
author: "Kalin"  
published: 2022-03-10  
updated: 2022-03-10  
canonical: https://www.mindstick.com/forum/156906/what-is-the-use-of-actionname-attribute-in-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# What is the use of ActionName Attribute in asp.net MVC?

What is the use of ActionName [Attribute in asp.net](https://www.mindstick.com/forum/156059/what-is-outputcache-attribute-in-asp-dot-net-mvc) [MVC](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc)?

## Replies

### Reply by Steilla Mitchel

## [ActionName] [Attribute](https://www.mindstick.com/blog/221/attributes-reflection) :

In [asp.net MVC](https://www.mindstick.com/forum/155798/what-is-caching-in-asp-dot-net-mvc) [ActionName] attribte is an action selector which is used for providing different name to the action methods. When we want to call a action method using different name instead of its actual name then we use [ActionName] attribute. See the example below in which there is a action method original name 'Index',

```
using System;
using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;namespace Mindstick.Controllers{public class HomeController : Controller{[ActionName('Home')]public ActionResult Index(){ViewBag.Message = 'Change the original method name by another name.';
return View('Index');}}}
```

In the above example if we need to call the action method Index then provide a correct way is - **http://localhost:12345/home/home.** If we use action method name Index instead of home then its throw 'server error in / Application'


---

Original Source: https://www.mindstick.com/forum/156906/what-is-the-use-of-actionname-attribute-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
