ASP .Net C#-下载后获取文件位置 [英] ASP .Net C# - Get File location after downloaded

查看:89
本文介绍了ASP .Net C#-下载后获取文件位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个简单的程序(使用ASP.Net C#)将GridView中的数据填充到Excel文件中. Excel文件将需要下载到客户端计算机中.

I'm currently developing a simple program (using ASP.Net C#) to populate data from GridView into Excel file. the Excel file will be need to downloaded into client computer.

由于某些原因,在将Excel文件下载到客户端本地计算机后,我需要快速对其进行操作.

For some reasons, I need to manipulate the Excel file quickly after it downloaded into client local computer.

问题是我无法获取文件下载的位置. 将文件下载到客户端计算机后如何获取文件位置?

The problem is I can't get the file location where the file was downloaded. How can I get the file location after it downloaded into client computer ?

这是屏幕截图:

下载代码:

private void Create_ExcelContent2()
{
    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("content-disposition", "attachment;filename=" + ddlBatchID.Text + ".xls");
    Response.Charset = "";
    Response.ContentType = "application/vnd.ms-excel";
    using (StringWriter sw = new StringWriter())
    {
        HtmlTextWriter hw = new HtmlTextWriter(sw); ...
        gvBatchSummary.RenderControl(hw);
        string style = @"<style> .textmode { } </style>";
        Response.Write(style);
        Response.Output.Write(sw.ToString());
        Response.Flush();
        Response.End();
    }
}

推荐答案

对此的简短回答是您无法做到.一旦文件在本地计算机服务器端,就无法使用代码来对其进行操作.如果可以的话,安全隐患将是一个雷区.

The short answer to this is you cannot do it. Once the file is on the local machine server side code cannot be use to manipulate it. If you could the security implications would be a mine field.

这篇关于ASP .Net C#-下载后获取文件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆