现在,当我将其从 mvc 控制器发送到 Web api(如“01-05-2020 00:00:00”)时,Web api 会将其获取为“05-01-2020 00:00:00”,如果我发送“21-” 04-2020 00:00:00' 它给出错误 400: BadRequest。
我在 Web api 中获取参数为
IHttpActionResult Applications(DateTime fromDate,DateTime toDate)
Run Code Online (Sandbox Code Playgroud)
Mvc控制器
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://localhost:44329/api/Values");
var postTask = client.GetAsync("/api/Values/Applications?fromDate=" + FromDate + "&toDate=" + ToDate );
Run Code Online (Sandbox Code Playgroud)