Then I thought well I still don't want anything that doesn't look like an mvc route (things that end in .foo or .fooo) Sounds like a crazy negative regex.
Here's the regular expression:
^(.(?!\.[a-zA-Z0-9]{3,}))*$
Match anything that doesn't look like a file extension
And here's the routeAdd in global.asax
static void RegisterRoutes(RouteCollection routes) { routes.MapRoute("mvc", "{controller}/{action}/{id}",defaults: new{action="index",id=""}, constraints:new{controller=@"^(.(?!\.[a-zA-Z0-9]{3,}))*$"}); }
No comments:
Post a Comment