I'm receiving the error:
System.UriFormatException: Invalid URI: The Uri string is too long.
The problem is with this line:
FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
Upon researching this I've learned it is because of a size limitation of the class FormUrlEncodedContent. But I'm not sure how I can workaround this? See code below:
public Token RequestToken(string username, int businessID, string requestXml)
{
var postData = new Dictionary<string, string>() { { "username", username }, { "businessID", businessID.ToString() }, { "authenticator", requestXml } };
FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
try
{
HttpResponseMessage response = _client.PostAsync("Token", content).Result;
if (response.IsSuccessStatusCode)
{
return response.Content.ReadAsAsync<Token>().Result;
}
}
catch (Exception ex)
{
log.Error(ex);
}
return null;
}
Can anyone help with this?