For the current WebAPI, I use a custom implementation of the OAuthAuthorizationServerProvider
.
I need to return a JSON response if the login has failed. This response is a simple ViewModel
containing lockout time, etc. if any.
I Am however, unable to send the response. It either gets cut off at 25
characters (??) or sends it as an escaped C# string
("\"lockout": 2"
etc.)
This is what i have tried so far:
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Write(JsonConvert.SerializeObject(authResult));