DotCat1985
DotCat1985

Reputation: 1

Remove Route annotation from an action in ASP.NET Core 8

In my ASP.NET Core 8 project, I added a reference to a nuget package containing the following controller:

public class ShoppingCartController : Controller
{
    // ...

    [HttpGet]
    [Route("cart")]
    public async Task<ActionResult> Index(string shoppingCartId = null)
    {
        // ...
    }

    // ...
}

How can I dynamically remove the data annotation [Route("cart")] from the Index action?

I would like remove this action with a code written inside the Startup.cs of my ASP.NET Core 8 project, so I can remap this action using route.MapAreaControllerRoute() inside Startup.cs.

Maybe I should remove it by using reflection?

Upvotes: 0

Views: 124

Answers (0)

Related Questions