Hi I am trying to use the Bing image search services and following the documentation from here https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/quickstarts/csharp
When I run my code debugging it on the BingImageSearch method with the line -
HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
It returns a 401 error. It is an authorization error. I am using this for the api calls:
const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/images/search";
const string accessKey = "********";
My accessKey is correct already checked on azure but I still get the 401 error. This is the rest of the code for the request:
// Construct the URI of the search request
var uriQuery = uriBase + "?q=" + Uri.EscapeDataString("Puppies");
// Perform the Web request and get the response
WebRequest request = HttpWebRequest.Create(uriQuery);
request.Headers["Ocp-Apim-Subscription-Key"] = accessKey;
What am I missing here? Is it something on the url?