在我的自定义授权属性代码中,我希望能够识别调用了哪个WebAPI方法。
我知道可以通过传递名称来实现这一点(参见示例2),但我不想这样做。
// Example1
[CustomAuthAttribute]
public MyResponse get(string param1, string param2)
{
...
}
// in the prev example I would like to be able to identify the
// method from within the CustomAuthAttribute code
// Example2
[CustomAuthAttribute(MethodName = "mycontroller/get")]
public MyResponse get(string param1, string param2)
{
...
}
// in this example I pass the controller/method names to the
// CustomAuthAttribute code
有没有办法我能够把这个东西拿起来?