c# - 在 URL 中将 JSON 作为查询字符串传递
问题描述
我需要在用户提供的唯一 URI 中将 JSON 文件作为查询字符串发送。我将 JSON 数据从我的 Angular 应用程序发送到 .net 核心应用程序,如下所示:
UploadData(vData:DataModel){
const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
return this.http.post<DataModel>(ROOT_URL, vData, httpOptions);
}
在我的 .net core 3.1 应用程序中,我收到如下数据:
[HttpPost]
public ActionResult<string> Post(Identitydata model)
{
}
由于我的数据已经在 JSON 中,我认为,我不需要格式化数据。如何将此数据作为查询字符串发送给客户端:
任何帮助将不胜感激