Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Missing optional routing argument not null

$
0
0

Hi!

I have a simple route with an optional "version" argument:

routes.MapRoute(name: "pages", template: "{action=Index}/{version?}", defaults: new { Controller = "Pages" });

and corresponding action method:

public IActionResult Index(Version version = null) { ... }

However, when I navigate to / the action method gets invoked with version = 0.0, not null. Where does that value come from and how can I fix that?

Thanks!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>