Removing action route #57035
Unanswered
DotCat1985
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Use this code and see if it works
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I developed the following class for removing any action route in
Startup.cs
:where the method
RemoveRoute()
removes a route given byrouteName
fromControllerEndpointRouteBuilderExtensions
object of ASP.NET Core framework.So, I created my Startup class as following:
where:
GetOrCreateDataSource()
returns thedataSource
object, which is a part of ASP.NET Core framework and contains the action routes I want to removeRouteManipulator.RemoveRoute(dataSource, "Login");
removes a route with the name "Login" from thedataSource
objectWhen I run the code above, the following line code of
RouteManipulator.RemoveRoute()
:var routes = routesFieldValue as List<object>;
returns always
null
even ifroutesFieldValue
has value. Maybe, I should writevar routes = routesFieldValue as List<ConventionalRouteEntry>;
, butConventionalRouteEntry
is an internal class (see the source code here).Perhaps, how can I solve my issue?
Beta Was this translation helpful? Give feedback.
All reactions