title: How to Add Uri to the Created(Status Code 201) of a Post Request
body: <p>i just started learning asp.net core api and i'm trying to make a post request from Postman. I want to return a status code of 201 upon post and return the Uri of the newly posted data as the location. Below is my controller code</p>
  
  <pre><code>    [HttpPost]
      public ActionResult CreateMake([FromBody]MakeResource makeresource)
      {
          if (!ModelState.IsValid) {
              return BadRequest(ModelState) ;
          }
         var makes = mapper.Map&lt;MakeResource, Make&gt;(makeresource);
          _makes.AddMake(makes);
          makeresource.Id = makes.Id;
  
          return Created(new Uri(Request.Path, UriKind.Relative), makeresource);
      }
  </code></pre>
  
  <p>I get an error </p>
  
  <blockquote>
    <p>System.UriFormatException: 'Invalid URI: The format of the URI could
    not be determined.'</p>
  </blockquote>
  
  <p>and I guess it has to do with the Uri(Request.Path).
  In Asp.net web api, I would implement it as <code>return Created(new Uri(Request.Uri + "/" + makes.Id), makeresource);</code> and the action type would be IHttpActionResult instead of ActionResult as shown in my controller but it doesn't work that way in asp.net core.
  Any assistance on how to solve this issue would be needed.
  Thanks.</p>