So I have a website lets say its website1.com. From this website I call out to an api lets say its webapi.com/api/
Once I am in my get/post/ I want to get the url. However I do not want the webapi.com/api url I want the website1.com url.
Is it possible to find the url of a website that calls the api? Because currently any research only brings up
Url.Request.RequestUri.AbsoluteUri
but this yields webapi.com/api which is not what I want.
Any help would be greatly appreciated.
Here is a quick code example I got working.
[Route("")]
public IHttpActionResult Get()
{
try
{
return this.Url.Request.RequestUri.AbsoluteUri;
}
catch (Exception e)
{
ErrorLogService.SaveErrorLog(e, this.User.Identity.Name);
return InternalServerError();
}
}
Note I am trying to find the url that is sending a request to the api inside the api. If this is not possible and I have to send the url as a parameter that's fine but I am curious if its possible.