I have to implement an MVC action that is invoked like this:
http://address/Controller/MyAction?resName=name
and it's called by a third party that is hardcoded to pass resName
. So the naive way is to have an action like this:
ActionResult MyAction( String resName )
{
but I think that having a parameter called resName
is uncool and I'd prefer to have it name resourceName
. If I just rename the parameter MVC parameter mapping no longer works and I always have resourceName
set to null
when my action is invoked.
I tried BindAttribute
like this:
ActionResult MyAction( [Bind(Include="resName")] String resourceName )
but resourceName
is still null
every time my action is invoked.
How do I remap my parameter name?