This might be a stupid question but I want to add a - into a controlle开发者_StackOverflowr name e.g. feature-request
How do I do this? I have tried creating one with a view however it can't be found.
Can anyone point me in the right direction?
Using the standard conventions in the MVC framework, you can't. Why? Because C# (actually .NET itself) doesn't support -
in type names.
I suspect you want this to allow your users to go to http://yoursite.com/feature-request/add or something - in that case, just add a route that sends them to the correct place.
routes.Map("FeatureRequestsRoute", "~/feature-requests/{action}/{id}",
new { controller = "FeatureRequest", action = "Index", id = UrlParameter.Optional });
Be sure to add the routes in the correct order - the default route matches anything, so this route has to be added before the default route.
精彩评论