CA2122:Microsoft.Security:'User.EmployeeId.get()'调用'PropertyValueCollection.Value.get()'

时间:2012-12-13 09:34:11

标签: code-analysis

 Warning    76  CA2122 : Microsoft.Security : 'User.EmployeeId.get()' calls into 'PropertyValueCollection.Value.get()' which has a LinkDemand. By making this call, 'PropertyValueCollection.Value.get()' is indirectly exposed to user code. Review the following call stack that might expose a way to circumvent security protection: 

- > 'User.EmployeeId.get()'     - >'User.EmployeeId.get()'C:\ WiproDaas \ WiproDaas \ DirectoryService \ User.cs 105 DirectoryService

 public string EmployeeId
    {
        get { return this["employeeID"].Value as string; }
        set { if (!string.IsNullOrEmpty(value)) this["employeeID"].Value = value; }
    }

嗨,我在get()附近面临警告,请帮我解决一下?

1 个答案:

答案 0 :(得分:1)

这是一个信任问题。尝试将以下属性添加到EmployeeId:

[EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]