public void OnActionExecuting(ActionExecutingContext context) { if (!IsAllowAnonymousRequest(context)) { if (!_authenticationHandle.AuthVerification(context.HttpContext, out string msg)) { var data = new Responses.ApiCommonResponseDto <object>(401, msg); context.Result = new JsonResult(data) { ContentType = "application/json;charset=utf-8" }; } } }
public async Task Invoke(HttpContext context) { //if (_authenticationHandle.AuthVerification(context, out string msg)) //{ // context.Response.OnCompleted(ResponseCompletedCallback, context); // await _next.Invoke(context); //} //else //{ var data = new Responses.ApiCommonResponseDto <object>(401, ""); context.Response.ContentType = "application/json;charset=utf-8"; await context.Response.WriteAsync(data.ToJson()); //} }