【发布时间】:2020-12-24 08:16:17
【问题描述】:
这里我需要传递多个存储地址并将这些值读取为 c# 中的 json。我试过下面的代码
var request = HttpContext.Current.Request;
string[] StorageAddress = request.Params["StorageAddress"];
但我没有得到响应,因为我需要如何通过邮递员 url 参数传递多个值并在代码中读取它。
更新
【问题讨论】:
-
你使用什么框架来处理这个请求?例如API 控制器。您可能希望查看在控制器上设置操作以将查询参数作为操作的输入作为路由的一部分。
-
如果你是 Web API,像这样 [FromQuery] string[] StorageAddress 装饰你的方法参数,这样就可以了。
-
@Joe_DM 使用 C#
标签: c# asp.net-web-api postman rest