I am trying to obtain and parse a table from azure storage.
I generated a Shared Access Signature in azure storage explorer.
If I paste the generated url into browser or postman I get the table back as xml.
However, trying to do a HttpWebRequest with the url results in
System.Net.WebException: 'The remote server returned an error: (415) Unsupported Media Type.'
I have tried different content and accept types
const string url = @"https://laptopdeploymentfiles.table.core.windows.net/PaulLoginScript?st=2019-08-21T08%3A10%3A22Z&se=2019-08-22T08%3A10%3A22Z&sp=r&sv=2018-03-28&tn=paulloginscript&sig=***";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
var webResponse = request.GetResponse();
I have tried both
request.Accept = "application/xml";
and
request.ContentType = "application/xml";
but still get the same error.
I have also tried creating and accessing a new table with only simple data. The data accessed via the brower is valid xml, but I still get the same error from a c# app.
The solution was to use both the following contenttype and accept formats
request.Accept = "application/json";
request.ContentType = "application/json";
The solution was to use both the following contenttype and accept formats
request.Accept = "application/json";
request.ContentType = "application/json";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With