MVC – What is the Purpose of [ActionName()]

Kaan Özkordağ/ April 29, 2014

I was very curios about the purpose of ActionNameAttribute in these past 3 days and I worked around a lot to find something about it. I will try to tell a little about  if you don’t  know this attribute. When you give this attribute to an Action , the Action (Method) Name  cannot be used at View part also you cant write it at the address bar from the browser as it written. Instead of this action (method) name you must use  the string ; which you defined at  [ActionName(“thestring“) ]  so the real ActionName  has been disabled. So what is the purpose of this attribute.

Sometimes you can’t see the needs of techniques and materials until you use them. Today I was working on a little project with MVC and I needed to give a name to an Action which includes a non-alphanumeric character . Then , it didn’t allow me to write that kind of a name as an ActionName . Guess what did solve  my problem ? ActionNameAttribute 🙂

Example :

At  the first picture as you see  it gives a Syntax Error :


And the second picture as you see there is no error and now you can use the address as ” http://localhost/Home/Operation-Manage ”


I hope you were also curios about this attribute before reading this article ,  and I wish that curiosity has been satisfied by this article.

Take Care ! Bye 😉

Share this Post


  1. I’m curious to find out what blog platform you’re utilizing? I’m having some small security problems with my latest site and I’d like to find something more safe. Do you have any suggestions?

  2. Ahaa, its gooԀ coոversation about this article here at this weblog, I haѵe read аll
    that, so at this time me also commenting heгe.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>