public HttpResponseMessage Post([FromBody] string fileLocation) { string response; FileExplorer explorer = new FileExplorer(); try { response = JsonConvert.SerializeObject(explorer.GetDirectories(fileLocation), Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } catch (Exception ex) { var resp = Utility.ExceptionMessage(ex); throw new HttpResponseException(resp); } return(new HttpResponseMessage { Content = new StringContent(response, System.Text.Encoding.UTF8, "application/json") }); }