Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不允许使用authorize属性_C#_.net_Asp.net Web Api - Fatal编程技术网

C# 不允许使用authorize属性

C# 不允许使用authorize属性,c#,.net,asp.net-web-api,C#,.net,Asp.net Web Api,假设我创建了CustomAuthorizeAttribute,它继承了System.Web.Http命名空间中的AuthorizeAttribute 如果有编译时保护,防止使用Authorize属性和消息来代替CustomAuthorize,那就太好了。我知道有ObsoleteAttribute会导致编译时错误,我们可以实现类似的功能吗?您可以尝试创建您的

假设我创建了
CustomAuthorizeAttribute
,它继承了
System.Web.Http
命名空间中的
AuthorizeAttribute


如果有编译时保护,防止使用
Authorize
属性和消息来代替
CustomAuthorize
,那就太好了。我知道有
ObsoleteAttribute
会导致编译时错误,我们可以实现类似的功能吗?

您可以尝试创建您的