环境:net framework 4.5.2


    1. /// <summary>
    2. /// 别名下载
    3. /// </summary>
    4. /// <param name="relativePath">相对路径:File/20220402/b21d7288-34d7-4629-97f3-ca81ead2d909.xlsx(当前文件一定要存在)</param>
    5. /// <param name="rename">别名:xxxx.xlsx</param>
    6. /// http://localhost:1197/File/Down?relativePath=File/20220402/b21d7288-34d7-4629-97f3-ca81ead2d909.xlsx&rename=111.xlsx
    7. /// <returns></returns>
    8. [HttpGet]
    9. public dynamic Down(string relativePath, string rename) {
    10. FileTool ft = new FileTool();
    11. return ft.Down(this, relativePath, rename);
    12. //return File(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + relativePath).OpenRead(), "application/octet-stream;charset=gbk", rename);
    13. }