How do I remap an MVC action parameter to another parameter name?

前端 未结 2 968
暗喜
暗喜 2021-02-01 14:08

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

2条回答
  •  一生所求
    2021-02-01 14:47

    Prefix is what you need:

    ActionResult MyAction( [Bind(Prefix="resName")] String resourceName )
    

    However, doing a http://address/Controller/MyAction?resourceName=name won't work with that setup.

提交回复
热议问题