MVC 5 does not set a parameter named action for the passed value

I have the following method:

public void Service(int id, string action)

When I click this as Url:

http://localhost/home/service?id=24&action=updated

MVC sets my “action” parameter to “service” (method name) no matter what I pass to the parameter.

Is it possible to override this "action" parameter from MVC to set it (via routes or any attributes)?

+4
source share
2 answers
Request.QueryString["ACTION"]

if you fill an object with a member called an action, it is possible that in the debugger it will turn out that this did not work, but it exists. check it using Console.WriteLine or another method.

+5
source

You need to rename the parameter to another.

"" - ASP.NET MVC, .

(: WebAPI)

+2

All Articles