I am working on providing friendly names for my MVC 4 controllers, and I want to do something like the [ActionName="My-Friendly-Name"] style, but for the entire controller.
I could not find any information about this attribute, so how can I do this? Also, will I need to add a new MapRoute to handle it?
EDIT:
For example, I would like to forward the following URL:
http:
sent to the following controller:
[ControllerClass="my-reports"] // This attribute is made up. I'd like to know how to make this functionality public class ReportsController : Controller { // // GET: /Reports/ public ActionResult Index() { return View(); } public ViewResult Details(int id) { Report report = db.Reports.Single(g => g.Id == id); return View(report); } public ActionResult Create() { return View(); } [HttpPost] public ActionResult Create(Report item) { try { if (ModelState.IsValid) { item.Id = Guid.NewGuid(); _context.Reports.AddObject(item); _context.SaveChanges(); return RedirectToAction("Index"); } return View(item); } catch (Exception) { return View(item); } }
}
source share