Web api c# - Get current path in controller

Asked

Viewed 59 times

-1

How do I get the current path of an endpoint in the controller?

1 answer

1

The object Request has that information:

var route = Request.Path.Value;

Remembering that it is the relative path, without the protocol ( http, etc.)

  • In my project that Httprequestmessage does not have the Path.... You would know what it is?

  • means you don’t have the object Path?

  • I was with classic Web Api project (net framework) there to get the URL to use Request.RequestUri.Absolutepath, net Core is like you said. Which helped me because I needed to do this not two

Browser other questions tagged

You are not signed in. Login or sign up in order to post.