Routing optional parameters in ASP.NET MVC 5
I am creating an ASP.NET MVC 5 application and I have some issues with routing. We are using the attribute Route to map our routes in the web application. I have the following action: [Route("{type}/{library}/{version}/{file?}/{renew?}")] public ActionResult Index(EFileType type, string library, string version, string file = null, ECacheType renew = ECacheType.cache) { // code... } We only can access this URL if we pass the slash char / in the end of url , like this: type/lib/version/file/cache/ It works fine but does not work without / , I get a 404 not found error, like this type/lib/version