MVC base64加密的文件,前端下载
后端代码:
public FileResult OutPutFile(string base64file,string filename)
{
buffer = Convert.FromBase64String(base64file);
}
//二进制形式输出返回给前端 文件类型
return File(buffer, "application/octet-stream", filename); //filename是客户端保存的名字
}
前端代码:
function OutPutFile(id) {
window.location.href = "/Controller/Action?ID=" + id;
}