I have the following code I have created to try and get rid of any magic strings related to MVC Action names. Potentially a dev could change the access mutator and access this in a page too.
private const string IndexAction = "Index";
public ActionResult Index(){
//do stuff
}
public ActionResult Other(){
// do stuff
if(foo)
return RedirectToAction(IndexAction);
//don't foo
}
I have never seen this anywhere which leads me to that it is not a good idea and in the world of programming I doubt I am the first person to try this. Question: Is putting the name of the action bad practice does it break any principal of MVC.