The remote server returned an error: (403) Forbidden When trying to make a web request in Windows Azure


  • I have a situation similar to the thread

    I already verified the certificate is in management certificates, but the problem persists, I don't know what else I can do to resolve the issue

    This is my code:


    const string x_ms_version = "2009-10-01";
    const string deploymentSlot = "Production";
    var requestUrl = "" + SubscriptionId + "/services/hostedservices/"+ ServiceName + "/deploymentslots/" + deploymentSlot;
    var restRequest = (HttpWebRequest)WebRequest.Create(requestUrl);
    restRequest.Method = "GET";
    restRequest.ContentType = "text/xml";
    restRequest.Headers.Add("x-ms-version", x_ms_version);
    var cert = LookupCertificate(CertificateThumbprintName);
    var restResponse = restRequest.GetResponse();
    var receiveStream = restResponse.GetResponseStream();
    var restResponseStream = new StreamReader(receiveStream, true);

    var responseBody = restResponseStream.ReadToEnd();



    Wednesday, December 22, 2010 9:42 PM


  • Now is working,

    Something was wrong with the certificate, I recreated it, exported the .cer and then reuploaded to azure (.pfx to the hosted service and .cer to management certificates)


    • Marked as answer by Mog Liang Thursday, December 30, 2010 5:24 AM
    Wednesday, December 22, 2010 11:29 PM