如题:
 前台代码:
   
<!--page:检测是否注册activeX,提供下载连接-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" >
    function checkReg() {
        //没有注册
        if ('undefined' == typeof mydll) { //检查是否注册activeX
            sendReq("Handler.ashx?type=getClientSetup", null, receiveFile); //请求acx
        }
    }
    
    function sendReq(url, data, stateChange) {
        var xmlHttp;
        try {
            xmlHttp = new XMLHttpRequest();
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    alert("您的浏览器不支持AJAX");
                    return;
                }
            }
        }
        xmlHttp.onreadystatechange = function() {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    stateChange(xmlHttp.responseText);
                }
                else {
                    alert("服务端异常");
                }
            }
        }
        xmlHttp.open("post", url, true);
        xmlHttp.send(data);
    }    //如何接收?
    function receiveFile(data) {    }
</script>
    <title></title>
</head>
<body onload ="checkReg()"></body>
</html>
后台代码:
  
<%@ WebHandler Language="C#" Class="Handler" %>using System;
using System.Web;
using System.IO;public class Handler : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        if (context.Request.QueryString["type"] == null) return;
        if (context.Request.QueryString["type"].ToString() == "getClientSetup")
        { 
            string fileName = "Assignment 1 EB3991 Lit review 2011-12.doc";//客户端保存的文件名 
            string filePath = HttpContext.Current.Request.PhysicalApplicationPath+ "\\"+fileName;
            
            //以字符流的形式下载文件 
            FileStream fs = new FileStream(filePath, FileMode.Open);
            byte[] bytes = new byte[(int)fs.Length];
            fs.Read(bytes, 0, bytes.Length);
            fs.Close();
            context.Response.ContentType = "application/octet-stream";
            
            //通知浏览器下载文件而不是打开 
            context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
            context.Response.BinaryWrite(bytes);
            context.Response.Flush();
            context.Response.End(); 
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    } 
}
现在前台 function receiveFile(data) 收到了data,但不是保存为本地文件的对话框。
如何才能保存成文件夹。  
备注: 不许在脚本中 以href的模式 透露文件的路径和名称