We use the OpenWeb js libraries on the interface, and they need an average .NET level to send them a specific HTTP header status code when certain types of errors occur. I tried to achieve this by doing the following:
public ActionResult TestError(string id) // id = error code { Request.Headers.Add("Status Code", id); Response.AddHeader("Status Code", id); var error = new Error(); error.ErrorID = 123; error.Level = 2; error.Message = "You broke the Internet!"; return Json(error, JsonRequestBehavior.AllowGet); }
It's kind of like halfway. See screenshot: http status code http://zerogravpro.com/temp/pic.png
Notice that I reached status code 400 in the response header, but I really need 400 in the request header. Instead, I get "200 OK." How can I achieve this?
My url structure for making a call is simple: / Main / TestError / 400
HerrimanCoder Aug 24 2018-12-12T00: 00Z
source share