﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Andrew Hallock commented on Reproducing a bug</title><description>Just curious as to why the ID is a hidden input value rather than a parameter in the URL. I started putting IDs in hidden inputs, but soon realized they really belong in the form's action attribute as part of the action path, since that's how you originally came to the resource.
  
  
Example:
  
  
GET:
  
/employee/123/edit
  
  
POST:
  
/employee/123/do-edit
</description><link>http://ayende.com/3683/reproducing-a-bug#comment13</link><guid>http://ayende.com/3683/reproducing-a-bug#comment13</guid><pubDate>Sun, 09 Nov 2008 23:28:28 GMT</pubDate></item><item><title>Ben Scheirman commented on Reproducing a bug</title><description>I have seen this behavior in past previews as well.  I usually get around it by changing my form values to not conflict with route values, but that get's aggravating after a while.
</description><link>http://ayende.com/3683/reproducing-a-bug#comment12</link><guid>http://ayende.com/3683/reproducing-a-bug#comment12</guid><pubDate>Sat, 08 Nov 2008 07:15:47 GMT</pubDate></item><item><title>Joe commented on Reproducing a bug</title><description>@Phil,
  
  
See my comment in Ayende's previous post. I could have sworn this wasn't the way it worked before. In the initial releases if the route didn't have a default value, but it was supplied in the query string then it would take that. Also renaming the parameter isn't always an option.
</description><link>http://ayende.com/3683/reproducing-a-bug#comment11</link><guid>http://ayende.com/3683/reproducing-a-bug#comment11</guid><pubDate>Fri, 07 Nov 2008 21:45:20 GMT</pubDate></item><item><title>Haacked commented on Reproducing a bug</title><description>Agreed, we'll take a look at it in our next triage meeting. I mentioned it's currently by design, but we will re-evaluate the design.
</description><link>http://ayende.com/3683/reproducing-a-bug#comment10</link><guid>http://ayende.com/3683/reproducing-a-bug#comment10</guid><pubDate>Fri, 07 Nov 2008 19:41:07 GMT</pubDate></item><item><title>LeviB commented on Reproducing a bug</title><description>Ayende - The team noticed that you opened a bug report on CodePlex &lt;&lt;a rel="nofollow external" href="http://www.codeplex.com/aspnet/WorkItem/View.aspx?WorkItemId=2549" title="http://www.codeplex.com/aspnet/WorkItem/View.aspx?WorkItemId=2549"&gt;www.codeplex.com/.../View.aspx?WorkItemId=2549
&gt; regarding this issue.  I commented on your feedback there to explain the subtleties of the situation a bit more.  Thanks for the feedback. :)
</description><link>http://ayende.com/3683/reproducing-a-bug#comment9</link><guid>http://ayende.com/3683/reproducing-a-bug#comment9</guid><pubDate>Fri, 07 Nov 2008 19:37:24 GMT</pubDate></item><item><title>Ayende Rahien commented on Reproducing a bug</title><description>The first one wasn't a bug report :-)
  
  
I would say that this is a wrong by design choice to make.
  
Especially when it took me a really long while to figure out what was going on.
  
The route doesn't have an ID parameter, so it should fall back to looking at the request params.
  
Only if it can't find anything, should it try to use the default.
  
  
As you noted yourself, this doesn't look right. It also mean that something that I do in one place can adversely and non obviously affect in a completely different place.
  
  
</description><link>http://ayende.com/3683/reproducing-a-bug#comment8</link><guid>http://ayende.com/3683/reproducing-a-bug#comment8</guid><pubDate>Fri, 07 Nov 2008 19:27:48 GMT</pubDate></item><item><title>Haacked commented on Reproducing a bug</title><description>Ok, it turns out this is by design right now. By convention, if you have a parameter name defined in your route with a default *and* you specify a parameter name to an action method with the same name, we assume you want us to populate that with the route value.
  
  
The easy fix is to change your default route from id to something else (routeID for example) so that there's no conflict. Otherwise the id in your action method has two meanings.
</description><link>http://ayende.com/3683/reproducing-a-bug#comment7</link><guid>http://ayende.com/3683/reproducing-a-bug#comment7</guid><pubDate>Fri, 07 Nov 2008 19:03:51 GMT</pubDate></item><item><title>Haacked commented on Reproducing a bug</title><description>Thanks! This is a much better bug report than your last one. ;) I confirmed this behavior and it definitely doesn't seem right. I'll circle back with my dev/QA team and figure it out. Thanks!
</description><link>http://ayende.com/3683/reproducing-a-bug#comment6</link><guid>http://ayende.com/3683/reproducing-a-bug#comment6</guid><pubDate>Fri, 07 Nov 2008 18:55:41 GMT</pubDate></item><item><title>Stephen commented on Reproducing a bug</title><description>Actually your issue on codeplex explains this more, for whatever reason, the routing obviously isn't looking at the default values last: one would think:
  
  
url parameters,
  
qs parameters,
  
form parameters,
  
default parameter (if its convertable)
</description><link>http://ayende.com/3683/reproducing-a-bug#comment5</link><guid>http://ayende.com/3683/reproducing-a-bug#comment5</guid><pubDate>Fri, 07 Nov 2008 17:23:21 GMT</pubDate></item><item><title>Simone commented on Reproducing a bug</title><description>@Stephen: the route must look only in the url... it's the action invoker that should probably be smarter to detect which id (the default one retrieved by the url parameter or the one that comes from the HttpRequest) is the right one
</description><link>http://ayende.com/3683/reproducing-a-bug#comment4</link><guid>http://ayende.com/3683/reproducing-a-bug#comment4</guid><pubDate>Fri, 07 Nov 2008 17:23:13 GMT</pubDate></item><item><title>Stephen commented on Reproducing a bug</title><description>I think this is purely because the routing isn't looking into form values to resolve parameters.. generally routing is resolved from url defined parameters or query string values.
</description><link>http://ayende.com/3683/reproducing-a-bug#comment3</link><guid>http://ayende.com/3683/reproducing-a-bug#comment3</guid><pubDate>Fri, 07 Nov 2008 17:10:32 GMT</pubDate></item><item><title>Simone commented on Reproducing a bug</title><description>I guess this is related to your previous post: in this case the action invoker takes the parameter that comes from the url parameter list, which should be (if u are using the default routes) and empty string. So it cannot find an valid int for the Test action.
  
Well... at least it's my guess without doing more tests... try removing the "id" parameter from the route and see what happens
</description><link>http://ayende.com/3683/reproducing-a-bug#comment2</link><guid>http://ayende.com/3683/reproducing-a-bug#comment2</guid><pubDate>Fri, 07 Nov 2008 17:03:19 GMT</pubDate></item><item><title>Rob commented on Reproducing a bug</title><description>Submit to codeplex?
</description><link>http://ayende.com/3683/reproducing-a-bug#comment1</link><guid>http://ayende.com/3683/reproducing-a-bug#comment1</guid><pubDate>Fri, 07 Nov 2008 16:50:18 GMT</pubDate></item></channel></rss>