public void DownloadAndStoreCertificate(object state)
		{
			LoadingSubscriptionData = true;

			string url = string.Format("http://{0}/Services/RetrieveCertificate/{1}/{2}", App.ServiceHostName, DevicePin, SubscriptionId);
			HttpWebRequest sendNotificationRequest = (HttpWebRequest)WebRequest.Create(url);
			sendNotificationRequest.Method = "GET";

			RequestState myRequestState = new RequestState();
			myRequestState.SubscriptionId = SubscriptionId;
			myRequestState.DevicePin = DevicePin;
			myRequestState.Request = sendNotificationRequest;
			sendNotificationRequest.BeginGetResponse(DownloadAndStoreCertificateCallback, myRequestState);
		}
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Load the hosted services!
            //
            string subscriptionId = "27b0e36c-5a3f-43e5-b104-1f5bdd1fa0e4";

            // The opperation to be performed. This value can be modified to reflect the operation being performed.
            string operationName = "hostedservices";

            // Build a URI for https://management.core.windows.net/<subscription-id>/services/<operation-type>
            Uri requestUri = new Uri("https://management.core.windows.net/"
                                    + subscriptionId
                                    + "/services/"
                                    + operationName);

            byte[] certificate = GetCertificateDataForSubscription(subscriptionId);

            if (certificate == null)
            {
                // We need the subscription's certificate??
            }
            else
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://localhost:6285/Services/InvokeSignedRequest"));
                request.Headers["X-Management-Url"] = requestUri.ToString();
                request.Method = "POST";

                RequestState state = new RequestState();
                state.Request = request;
                state.SubscriptionId = subscriptionId;
                state.Certificate = certificate;

                request.BeginGetRequestStream(GetRequestStreamCallback, state);
            }
        }