【发布时间】:2015-03-09 11:56:15
【问题描述】:
我在 asp.net mvc5 中有以下操作方法,我将其定义为 ChildActionOnly:-
[ChildActionOnly]
public ActionResult GetChildRecords(int customerid)
在我看来,我将其称为如下:-
<div>@Html.Action("GetChildRecords", "Customer", new {customerid = Model.CustomerID})</div>
但我有以下问题:-
我需要在子操作方法之前添加 [Authorize] 注释吗?或者我可以确定,因为它的父级被授权,所以子操作方法也将被授权?
用户或黑客可以直接调用 ChildActionOnly 吗?
用户或黑客是否可以修改 Html.Action 参数?例如在下面的 html 中传递不同的 customerid:-
@Html.Action("GetChildRecords", "Customer", new {customerid = 模型.客户 ID})
?
【问题讨论】:
标签: asp.net asp.net-mvc asp.net-mvc-5 authorize-attribute actionmethod