Here is my method It will take only one parameter . But I want user whaterver add in request body I need to save in logging.
[HttpPost]
[LogAPIUser]
public async Task<JsonResult> GameDetail(long game)
In ActionExecutingContext I have got only one action parameter
How can I get all body request data? If anyone have idea please let me know
Thanks in advance.
At most one parameter is allowed to read from the message body.
The reason for this rule is that the request body might be stored in a non-buffered stream that can only be read once.
You can try to look at this question: WebAPI Multiple Put/Post parameters
something in the effect of
[HttpPost]
public string MyMethod([FromBody]JObject data)
{
long game = data["game"].ToObject<Long>();
long rer = data["rer"].ToObject<Long>();
}
(did not try code, might be buggy)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.