WebApi使用URL拼接参数形式传人后台自动解析为实体对象
WebApi使用URL拼接参数形式传人后台自动解析为实体对象
测试代码:
C# Code:
//使用URL拼接参数形式传人后台自动解析为实体对象
//ContentType必须为:application/x-www-form-urlencoded;
string url_param = "act=000000&apikey=22222&data=333333&encrypt=false&sign=444444";
string result = WebApiTools.Post("http://localhost:8899/api/testapi/post",
url_param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;
//来源:C/S框架网(www.csframework.com) QQ:1980854898
WebAPI接口:
测试结果:
测试代码:
C# Code:
//使用URL拼接参数形式传人后台自动解析为实体对象
//ContentType必须为:application/x-www-form-urlencoded;
string url_param = "act=000000&apikey=22222&data=333333&encrypt=false&sign=444444";
string result = WebApiTools.Post("http://localhost:8899/api/testapi/post",
url_param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;
//来源:C/S框架网(www.csframework.com) QQ:1980854898
WebAPI接口:
C# Code:
[HttpPost]
[Route("post")]
public override IUserResponse DoPost(ModelRequest model)
{
return new ModelResponse { Code = 0, Message = ".Post-->OK" };
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
[HttpPost]
[Route("post")]
public override IUserResponse DoPost(ModelRequest model)
{
return new ModelResponse { Code = 0, Message = ".Post-->OK" };
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
测试结果:
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网