Good day. I try using the ActionFilterAttribute class to get the input parameters of a POST request in this way:
public override void OnActionExecuting(ActionExecutingContext filterContext) { log.Trace($"Params: {filterContext.HttpContext.Request.QueryString}"); } The request itself:
function GetData() { $.ajax({ url: "http://localhost....", type: 'POST', dataType: 'json', data: JSON.stringify({ value: JSON.stringify("Параметры")}), crossDomain: true, processData: false, contentType: 'application/json, charset=utf-8', headers: { User: "User", Password: "Password" }, success: function (q, w, e) { alert(JSON.stringify(q)); }, error: function (q, w, e) { alert("Ошибка: " + w); } }); } The string filterContext.HttpContext.Request.QueryString comes all the time empty. Tried to get input parameters through filterContext.HttpContext.Request.InputStream; filterContext.HttpContext.Request.BinaryRead(int); filterContext.HttpContext.Request.InputStream; filterContext.HttpContext.Request.BinaryRead(int); , but they are also empty, although the request fulfills and returns the result. Maybe someone uses filters in MVC and can tell how to get the input parameters of the request in the OnActionExecuting method via the filterContext variable?
var param = filterContext.ActionParameters["value"];- Ruslan_K