C#.NET WEBAPI 接口设计-调用多个参数的接口
C#.NET WEBAPI 接口设计-调用多个参数的接口
WEBAPI接口方法,必须使用HttpGet以及ActionName特性!
调用
WEBAPI接口方法,必须使用HttpGet以及ActionName特性!
C# Code:
[HttpGet]
[ActionName("post-data")]
public HttpResponseMessage PostData(string apikey, string data, string sign)
{
return new HttpResponseMessage();
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
[HttpGet]
[ActionName("post-data")]
public HttpResponseMessage PostData(string apikey, string data, string sign)
{
return new HttpResponseMessage();
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
调用
C# Code:
string url = "http://localhost:8899/api/fuyou/post-data";
string param = "apikey=99999999&data=asdf0&sign=有新的报价信息";
//string result = WebApiTools.Get(url, param, "text/html;charset=UTF-8");//OK
string result = WebApiTools.Get(url, param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;
//来源:C/S框架网(www.csframework.com) QQ:1980854898
string url = "http://localhost:8899/api/fuyou/post-data";
string param = "apikey=99999999&data=asdf0&sign=有新的报价信息";
//string result = WebApiTools.Get(url, param, "text/html;charset=UTF-8");//OK
string result = WebApiTools.Get(url, param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;
//来源:C/S框架网(www.csframework.com) QQ:1980854898
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网