Web API Url Parameters and (JSON) Payload being overwritten - by Shiv Kumar

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 731695 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/16/2012 4:14:42 PM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration

Description

I have a route defined like so:

            RouteTable.Routes.MapHttpRoute(
                name: "Members API",
                routeTemplate: "api/members/{username}",
                defaults: new { controller = "Members", username = RouteParameter.Optional });

I have a "PUT" method in my controller like so:

public void Put(string username, Member member)
{
}

Now when I make an Http PUT request with a url such as

http://localhost/myapp/members/skumar

And a JSON Payload such as

{
"firstName":"Shiv","lastName":"Kumar", "username": "xxxxx"
}

The username parameter to the method has a value of "xxxxx" instead of "skumar". I would expect that the parameter comes in as whatever is on the url while the Member parameter gets populated using only the JSON payload.

Sign in to post a comment.
Posted by Microsoft on 3/23/2012 at 10:49 AM
Hi,

We have fixed this bug. The fix will be available in the next release of the ASP.NET MVC runtime.

Thanks,
The ASP.NET Team
Posted by MS-Moderator10 [Feedback Moderator] on 3/19/2012 at 3:35 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 3/16/2012 at 4:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)