© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
49 replies
Sun

Get route information on controller

In my response model, I have stuff like method and path of the route. Is there any classes or methods I can call to inject that into the function?

Example
class FooController : ControllerBase {
  [HttpGet] // I know it's a get here, but not during runtime
  async Task<ActionResult<CoolioResponse>> Bar(
    // What to inject here? HttpContext?
  ) {
    
  }
}
class FooController : ControllerBase {
  [HttpGet] // I know it's a get here, but not during runtime
  async Task<ActionResult<CoolioResponse>> Bar(
    // What to inject here? HttpContext?
  ) {
    
  }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ASP .NET Core Controller Default Route Issue
C#CC# / help
3y ago
Get information about DI container:
C#CC# / help
13mo ago
❔ Add extension on controller
C#CC# / help
3y ago