开发者

How to send a parameter from a .NET Rest Client Method using GET

开发者 https://www.devze.com 2023-03-13 10:01 出处:网络
My Code: protected void btFeedsPorFechaPublicacion_Click(object sender, EventArgs e) { WebClient proxy = new WebClient();

My Code:

    protected void btFeedsPorFechaPublicacion_Click(object sender, EventArgs e)
    {
        WebClient proxy = new WebClient();
        byte[] data = proxy.DownloadData(new Uri("http://tribilin.codefactorycr.com/SORS开发者_如何转开发SJ/rest/servicio/ObtenerFeedsRecientes"));

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

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

    }

The Method ObtenerFeedsRecientes needs a param called "tag" how should i modify btFeedsPorFechaPublicacion to acomplished that?

Thank you!


The only thing i had to do was this:

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

In Get the param is assumed to be send without specifying its name! i didn´t know that. Hope this helps someone in the future ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消