Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: Modelbinding does not bind the route value properly if its an empty string or only has whitespace in it [974]

$
0
0
While testing attribute routing for default values, I noticed that for the following route and action, the parameter "name" is always null

Change the value of name here to : empty string or only having whitespace characters.

```
config.Routes.MapHttpRoute("Default", "api/values", new { controller = "values", name = "", id = RouteParameter.Optional });

public class ValuesController : ApiController
{
public string Get(string name)
{
return "Get. name: " + (name == null ? "null" : name);
}
```

__Attached__ a standalone repro.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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