0

I'm trying to make a call with WebClient.UploadValues, but I'm having a little problem.

It works fine this way:

NameValueCollection parametros = new NameValueCollection();
parametros.Add("idUsuarioSolicitante", "24");
parametros.Add("localColeta", "3");
parametros.Add("requisicaoDTOListaJSON", "1");

var retorno = conexao.UploadValues("SincronizacaoAPI/SincronizarRequisicao", parametros);

But when I put my JSON param I got a 404 error:

NameValueCollection parametros = new NameValueCollection();
parametros.Add("idUsuarioSolicitante", "24");
parametros.Add("localColeta", "3");
parametros.Add("requisicaoDTOListaJSON", JsonConvert.SerializeObject(
     TransformadorDTOEntidade.GetRequisicaoSinc(requisicaoPendenteLista)));

var retorno = conexao.UploadValues("SincronizacaoAPI/SincronizarRequisicao", parametros);

Details:

Signature of the method I'm trying to call:

public string SincronizarRequisicao(int idUsuarioSolicitante, int localColeta,
        string requisicaoDTOListaJSON)
{
    ...
}

(I'm calling a controller from another controller, two diferent projects. .NET Framework 4.5.)

1 Answers1

0

Try with less items like 3-5. You may exceed the request length. In order to increase the request length check this SO answer:

Click here

Fatih TAN
  • 778
  • 1
  • 5
  • 23