public virtual void Process(Exception ex, ILogger logger) { string hardwareId = HardwareId.Get(); if (!String.IsNullOrEmpty(hardwareId)) { logger.WriteValue("logifyHardwareId", hardwareId); } }
string GetConfigurationJson(string serviceUrl, string apiKey) { try { string instanceId = HardwareId.Get(); WebRequest request = WebRequest.Create(CreateEndPointUrl(serviceUrl, String.Format("api/config/get?instanceId={0}", instanceId))); SetupProxy(request); request.Method = "GET"; request.Headers.Add("Authorization", "amx " + apiKey); //request.ContentType = "application/json"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; if (response == null || response.StatusCode != HttpStatusCode.OK) { return(String.Empty); } using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } } } catch { return(String.Empty); } }