如何使用GET从.NET Rest Client方法发送参数

时间:2011-06-17 05:09:34

标签: .net rest get

我的代码:

    protected void btFeedsPorFechaPublicacion_Click(object sender, EventArgs e)
    {
        WebClient proxy = new WebClient();
        byte[] data = proxy.DownloadData(new Uri("http://tribilin.codefactorycr.com/SORSSJ/rest/servicio/ObtenerFeedsRecientes"));

        System.Text.UTF7Encoding utf = new UTF7Encoding();
        string s = utf.GetString(data);

        FeedEstructuradoC[] d = JsonConvert.DeserializeObject<FeedEstructuradoC[]>(s);

    }

方法ObtenerFeedsRecientes需要一个名为“tag”的参数我应该如何修改btFeedsPorFechaPublicacion来完成它?
谢谢!

1 个答案:

答案 0 :(得分:1)

我唯一需要做的就是:

byte[] data = proxy.DownloadData(new Uri("http://tribilin.codefactorycr.com/SORSSJ/rest/servicio/ObtenerFeedsRecientes/" + tbTag.Text));

在Get中,假设param被发送而没有指定它的名字!我不知道。 希望这有助于将来的某些人;)

相关问题