//循环显示附件,并设置超链接,指出上传后所在的完整目录路径;
//当我点击文件时,如果文件很少,比如: .TXT文件,就直接打开了,而不会弹出下载对话框,请问这个问题如何解决啊?
//这是设置超链接的代码:
                    for (int i = 0; i < AccIDList.Length; i++)
                    {
                        LblAcc.Text += "<a href=\"file/"
                            + AccIDList[i]
                            + "\" target=\"_blank\">"
                            + AccList[i]
                            + "</a>" + "<br>";                    }

解决方案 »

  1.   

    链接的写法:
    <a href='download.aspx?file=xxx.txt''download.aspx里面使用Response.ContentType = "application/octet-stream";
    Response.AddHeader("Content-Disposition", "attachment;FileName="+YourFileName);
    Response.Flush()
    Response.WriteFile(filepath);
    Response.End();
      

  2.   

    链接的写法: 
    <a href='download.aspx?file=xxx.txt' 'download.aspx里面使用 Response.Clear();
    Response.ContentType = "application/octet-stream"; 
    Response.AddHeader("Content-Disposition", "attachment;FileName="+YourFileName); 
    Response.Flush() 
    Response.WriteFile(filepath); 
    Response.End();
      

  3.   


    我按照上面的方式做,但是下载的后缀名为html,而不是原来的,?