<a   target="_blank"   href="http://ss/xx.doc">X</a> 
这是直接弹出对话框询问打开还是下载,能不是直接打开,而不是弹出对话框再选择

解决方案 »

  1.   

    doc,pdf什么的支持IE打开的.可以做一个下载页面啊
      

  2.   

    to jadezhou83
    呵呵,我的意思就是你的a标签的链接url就不要指向具体的下载文件,而是统一的一个下载页面(那个页面上可以构造标签<a   target="_blank"   href="http://ss/xx.doc">X</a> )
    比如原来你的a 标签所在页面可以
    <a   target="_blank"   href="http://ss/xx.aspx?fileid="+param>X</a> 
    //param是下载文件的唯一标识
    然后统一下载页面(xx.aspx)就可以通过fileid来构造出以下标签,用户点击就可以实现你的要求了
    <a   target="_blank"   href="http://ss/xx.doc">X</a>
      

  3.   

    如果是文本的话,用连接只能打开,不能出现下载对话框的
    你用下面的试试
    我在做上传下载的时候用的:
                 System.IO.FileInfo objFileInfo;
                if (System.IO.File.Exists(PhysicalPath))
                {
                    objFileInfo = new System.IO.FileInfo(PhysicalPath);
                    System.Web.HttpContext.Current.Response.Clear();
                    System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + objFileInfo.Name);
                    System.Web.HttpContext.Current.Response.AddHeader("Content-Length", objFileInfo.Length.ToString());
                    System.Web.HttpContext.Current.Response.ContentType = FileType;
                    System.Web.HttpContext.Current.Response.WriteFile(objFileInfo.FullName);
                    System.Web.HttpContext.Current.Response.End();
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "a", "<Script>alert('文件不存在!');</Script>");
                }PhysicalPath 下载文件的路径
    FileType 下载文件的类型
      

  4.   

    用Response输出来
    注意文件类型