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
会导致编译时错误,我们可以实现类似的功能吗?您可以尝试创建您的