IE wants to download JSON result…MVC3

后端 未结 3 1316
既然无缘
既然无缘 2021-01-22 01:01

My MVC3 app uploads documents from the user to our server. I am returning a JsonResult to display any errors, if any:

  [HttpPost] 
    public JsonResult SaveDoc         


        
3条回答
  •  庸人自扰
    2021-01-22 01:43

    The proper JsonResult return should look like so:

    [HttpPost] 
    public JsonResult SaveDocument(DocumentModel model, HttpPostedFileBase postedFile)
    {
        ...
        return Json(new { success = true, message="ok" }, "application/json; charset=utf-8", JsonRequestBehavior.AllowGet);
    }
    

提交回复
热议问题