I have the following method:
public void Service(int id, string action)
When i hit this as a Url:
http://localhost/home/service?id=24&action=updated
MVC is setting my parameter "action" as "service" (the name of the method) regardless of what i pass in to the parameter.
Is there anyway to override this "action" parameter from MVC setting it (via routes or any attributes)?
Request.QueryString["ACTION"]
if you are filling in an object with a member called action, it's possible that in the debugger it will appear this has not worked, but it has. check it with Console.WriteLine or another method.
You'll need to rename the parameter to something else.
"action" is a special case in ASP.NET MVC, so you need to avoid using it for another purpose.
(Note: this does work correctly in WebAPI)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With