ASP.NET MVC: The right way to propagate query parameter through all ActionLinks

前端 未结 6 2289
礼貌的吻别
礼貌的吻别 2020-12-15 13:27

In my application, key query string parameter can be used to grant access to certain actions/views.
Now I want all ActionLinks and Forms to automatically in

6条回答
  •  春和景丽
    2020-12-15 14:22

    How about adding the key to route values.

    {controller}/{action}/{key}

    Whenever a url contains a querystring with key=somevalue, the url will look like

    Home/Index/somevalue,

    Now all the action links and relative urls also will include this by default.

提交回复
热议问题