Is it possible to add some sort of meta data to a view to make the URL to be different than the view name?
Example:
[DisplayName("My-View")]
public ActionResult MyView()
{
return View();
}
As you see, I would like the url to be www.mydomain.com/My-View not www.mydomain.com/MyView.
I guess that can be sorted with some routing or IIS rewriting, but there really should be som sort of meta functionality to this.
Use the
ActionNameinstead ofDisplayName: ActionNameAttributeThis attribute will allow you to to start your action with a number or include any character that .net does not allow in an identifier. Via this way you can have nice URL’s without the hassle of rewriting via other methods.
Example