Asp添加标题以使响应无效

时间:2018-05-10 09:36:52

标签: c# asp.net

我尝试在过滤器中添加标头:

 Response.AppendHeader("Content-Encoding", "gzip");

但它不会出现在浏览器中,不会出现在Chrome中,也不会出现在Firefox中:

enter image description here

这就是我如何回归json:

[HttpPost]
public virtual ActionResult GetMetaData()
{

        var result = new BL().GetMetaData();
        string response = JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
        return Content(response, "application/json");

}

0 个答案:

没有答案