Removing an inherited attribute in .net

I got an ASP.NET MVC controller like this

[Authorize]
public class ObjectController : Controller
{
     public ObjectController(IDataService dataService)
     {
         DataService = dataService;
     }
     public IDataService DataService { get;set;}
}

The Authorize attribute is defined as "Inherited = true" in the structure. Therefore, when I do the following controller:

public class DemoObjectController : ObjectController 
{
    public DemoObjectController(IDataService dataService)
        : base (dataService)
    {
        DataService = new DemoDataService(DataService);
    }
}

It gets the authorize attribute, but I don't want it here. I want the Demo Object controller to be accessible to everyone because it just uses fake data.

I assume that I am implementing my own Authorize attribute, which does not get inherited, since I cannot find a way to remove the attribute from the inherited class.

+5
source share
2 answers

, ( , ). .

MVC ( On*), .

+5

, . , , AthorizeAttribute, .

0

All Articles