In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Questions about ApiController and Controller
When using Controller, the input parameters are obtained directly from the request body.
If ApiController is used, [FromBody] must be marked in the input parameters, otherwise the data cannot be extracted.
Questions about how to view Body data for Post requests
First, we can build a class that inherits ActionFilterAttribute, and then override the OnActionExecuting method
Code
/ / write the request to the Log4Net communication log
Var request = HttpContext.Current.Request
Request.InputStream.Position = 0 position / Core Code
Byte [] byts = new byte [request.InputStream.Length]
Request.InputStream.Read (byts, 0, byts.Length)
String str = Encoding.UTF8.GetString (byts)
/ / webapi log is written to debug
If (! String.IsNullOrEmpty (str))
{
LogHandle.WriteLog (typeof (ActionFilterAttribute), LogHandle.LogLevel.Debug, str)
}
The method of writing a log with Log4net above can be Baidu, or you can write your own text first.
Then add a feature to the relevant Post method, and the data of the BODY in the POST will be written to the local file when called directly.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.