0

how to get current route controller full url path in net core 3.1?

if I am in method test of mycontroller, it should be:

https://example.com/demo/x/api/my/test

how to get https://example.com/demo/x/api/my programmatically?

I try:

 String originalPath = new Uri(HttpContext.Request.GetDisplayUrl()).AbsoluteUri;
 

it returns http://example.com/my/test

DevDon
  • 101
  • 7
  • https://stackoverflow.com/questions/30755827/getting-absolute-urls-using-asp-net-core – jaypb Jul 01 '20 at 15:28
  • Possible duplicate of https://stackoverflow.com/questions/41511568/get-the-full-route-to-current-action (at least if you don't need the the server/domain name in the URL). – Tobias Nov 24 '20 at 11:22

0 Answers0