Skip to main content

Status code 415 unsupported media type in web api

In my application it was an issue because client was encoding the body content.But I was not specifying the encoding or media type. I have specified and resolved the issue as below

var content = new StringContent(postData, Encoding.UTF8, "application/json");
httpClient.PostAsync(uri, content);

Comments

Popular posts from this blog

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...