Overriding AuthorizeCore in custom Authorize attribute results in “no suitable method found to override” error

前端 未结 7 1038
悲哀的现实
悲哀的现实 2020-12-13 19:21

I\'m trying to build custom AuthorizeAttribute, so in my Core project (a class library) I have this code:

using System;
using System.Web;
using System.Web.Mv         


        
7条回答
  •  庸人自扰
    2020-12-13 19:27

    I had this error too. It turned out that Visual Studio had added to my ActionFilter by default:

    using System.Web.Http;

    Even when I added System.Web.Mvc I still got the error. Commenting out System.Web.Http and just using System.Web.Mvc seems to solve the problem for me.

    Hoping this might help someone!

提交回复
热议问题