Avoid hard-coding controller and action names

Viewed 3585

ASP.NET MVC seems to be encouraging me to use hard-coded strings to refer to controllers and actions.

For example, in a controller:

return RedirectToAction("Index", "Home");

or, in a view:

Html.RenderPartial("Index", "Home");

I don't want hard-coded strings all over my code. What can I do to avoid this?

5 Answers
Related