I would like to catch the path of my controller as a string in order to process every requests:
[ApiController]
[Route("[controller]")]
public class BackendController : ControllerBase
{
[Route("Backend/{url}")]
public Task<HttpResponseMessage> CatchAll(string url)
{
var requestmessage = HttpContext.Request;
//Do stuff
}
}
I found a lot of thing in asp.net core 2.1 but I didn't managed to make it work with my solution..
Thanks in advance
The result from above code:
Url: https://127.0.0.1:5001/api/backend/GenericAction/product?id=100
Response:
url: product, queryString: ?id=100
url: https://127.0.0.1:5001/api/backend/GenericAction/company?name=michael
Response:
url: company, queryString: ?name=michael
Edit
If you want to add all http action to one
Edit
Without action name