开发者

How do I make Hammock issue an HTTP GET

I have开发者_运维技巧 a Silverlight 4.0 application that is making RESTful calls to an MVC3 application using the Hammock API on the client to issue the RESTful service codes.

The problem is that whether the request.Method is set to WebMethod.Get or WebMethod.Post, the request that is sent is a POST. What am I doing wrong?

private IAsyncResult GetServerList()
{
    var callback = new RestCallback((restRequest, restResponse, userState) =>
                {
                    // There is some working callback code here.  Excluded for clarity.
                }
            );

    var request = new RestRequest();
    request.Method = WebMethod.Get;
    request.Path = "ServerList";
    return _restClient.BeginRequest(request, callback);
}


Try setting the request type on RestClient.

var restClient = new RestClient
        {
            Method = WebMethod.Get
        };

Or from your example:

private IAsyncResult GetServerList()
{
    var callback = new RestCallback((restRequest, restResponse, userState) =>
            {
                // There is some working callback code here.  Excluded for clarity.
            }
    );

    var request = new RestRequest();
    request.Path = "ServerList";

    _restClient.Method = WebMethod.Get;
    return _restClient.BeginRequest(request, callback);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜