Get the full route to current action

You can get the complete requested url using the Request option (HttpRequest) in .Net Core.

var route = Request.Path.Value;

Your final code.

[Route("api/[controller]")]
public class DocumentController : Controller
{
    [HttpGet("info/{Id}")]
    public async Task<Data> Get(string Id)
    {
        var route = Request.Path.Value;
    }
}

Result route: “/api/document/info/some-id-here” //for example

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)