Posted on: 3/11/2014 5:50:20 PM | Views : 312

I am writing to ask, how do I add in response (message) in the following code, when the user fails to authorize:
Test API controller:
[Authorize] public HttpResponseMessage GetRole(string username) { var user = repository.GetRolesForUser(username); if (user != null && user.Length > 0) { return Request.CreateResponse(HttpStatusCode.OK, user); } var mes = string.Format("no role"); return Request.CreateErrorResponse(HttpStatusCode.NotFound, mes); } Would I need edit the authorize handler or can I do in the test api controller? Any help much appreciated.

Go to the complete details ...