Hi MrC,
I think I've solved it. Instead of escaping the whole querystring at once I've now implemented escaping of only the parts in the query string. The url now comes out like this:
http://192.168.75.1:52199/MCWS/v1/Files/Search?Action%3DPlay&Query%3D%5BArtist%5D%3D%22Supertramp%22%20%5BAlbum%5D%3D%22Crime%20of%20the%20Century%22%20~sort%3D%5BTrack%20%23%5D&Zone=0&ZoneType=ID
I've altered the ToString() of my MCParameters (Dictionary) class like so:
/// <summary>
/// Return all the parameters as a string in format "?parameter1=value¶meter2=value&etc..."
/// </summary>
/// <returns></returns>
public override string ToString()
{
StringBuilder result = new StringBuilder();
string separator = "?";
foreach (KeyValuePair<string, object> parameter in this)
{
string parameterPart = Uri.EscapeDataString(parameter.Key + "=" + parameter.Value);
// result.Append(separator).Append(parameter.Key).Append("=").Append(parameter.Value);
result.Append(separator).Append(parameterPart);
separator = "&";
}
if (MCStatic.CurrentZone != null)
{
result.Append(separator).Append("Zone=").Append(MCStatic.CurrentZone.Id).Append("&").Append("ZoneType=ID");
}
return result.ToString();
}
The sort works fine now. Thanks again.
Regards
Paul