Reputation: 2810
I have a controller like below:
public async Task<IHttpActionResult> MyControllerMethod(string currency = null,
string edition = null,
int? systems = null,
string version = null,
Guid? entitlementid = null)
{
//Code here
}
When i execute this controller from this URL:
http://*:*/MyController/MyControllerMethod/?currency=eur&edition=DSSTANDARD&systems=50&version=6.3/
All the parameters of the method have the values like below:
currency = eur
edition = DSSTANDARD
systems = 50
version = 6.3
But if i do the same adding the last parameter:
...&entitlementid=B5630B37-0820-4EB0-8A2A-000C44885590/
Then, the first 3 values have the values from URL but entitlementid
is always null
.
What can be the issue?
Route Config
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Upvotes: 1
Views: 1065
Reputation: 247541
You are including an extra slash /
at the end of the query string
...&entitlementid=B5630B37-0820-4EB0-8A2A-000C44885590/
which is causing the Guid
binding to become invalid. If you remove the slash and make the request then the entitlementid
will be populated.
http://*:*/MyController/MyControllerMethod/?currency=eur&edition=DSSTANDARD&systems=50&version=6.3&entitlementid=B5630B37-0820-4EB0-8A2A-000C44885590
Should work as expected.
Upvotes: 1