0
在我的网站中,我给了下载选项来下载文件。当我在本地服务器检查它正在正常工作。但经过部署服务器,如果我点击链接意味着它会显示以下错误,在mvc2中下载文件时出现错误
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.
我的代码在这里
public ActionResult Download(string fileName)
{
string pfn = Server.MapPath("~/Content/Files/" + fileName);
if (!System.IO.File.Exists(pfn))
{
//throw new ArgumentException("Invalid file name or file not exists!");
return Json(new JsonActionResult { Success = false, Message = "Invalid file name or file not exists!" });
}
else
{
return new BinaryContentResult()
{
FileName = fileName,
ContentType = "application/octet-stream",
Content = System.IO.File.ReadAllBytes(pfn)
};
}
}
这是我的代码。我不知道这里有什么错误,有谁能找到我的问题并告诉我?
这会为你工作.. –