¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

SimplSharp with HttpClient


 

When I run my code on my RMC4 I get an error of "Input string was not in a correct format".

here is my code: where 192.168.1.22:8080 is my local server and myCD.xml is my CD collection

byte[] vs = new HttpClient().GetBytes("192.168.1.22:8080/myCD.xml");
? ? ? ? ? ? var bytes = vs;
? ? ? ? ? ? CrestronConsole.PrintLine("bytes : {0}", bytes);
? ? ? ? ? ? return bytes.ToString();


 
Edited

You are missing the scheme prefix... Either http:// or https://.

* You also don't want to be creating and ignoring IDisposable objects like that. If this is the .NET 4.5+ HttpClient from System.Net.Http.dll then you don't want to be disposing of it like that either. It requires a special usage in most cases, and you'd be able to get away with creating and disposing instances of it only if you aren't making too many requests within a shorter amount of time.

--
?
Crestron Service Provider - TBD Enterprises Inc.