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

Closed Issue: Url link generation is taking current request's route values when not explicitly supplied. [931]

$
0
0
Route:
```
config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional });
```

Controller:
```
public class ValuesController : ApiController
{
public string Get()
{
return "value";
}

public string Get(int id)
{
return Url.Link("DefaultApi", new { controller = "Values" });
}
}

```
Request:
http://kcthinkpad:9096/api/values/400

Response:
Expected: http://kcthinkpad:9096/api/Values
Actual: http://kcthinkpad:9096/api/Values/400

Workaround: user can explicitly set the parameter: id=""
Comments: This should be by design and the workaround is not bad.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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