This might be a stupid question but I want to add a - into a controller name eg 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.