views:

12

answers:

0

Hello. I've got http handler, which returns file, by post parameters:

    public void ProcessRequest(HttpContext context)
    {
        string user = HttpContext.Current.User.Identity.Name;
        FilePermissionHelper helper = new FilePermissionHelper(user);
        string path = context.Request.Form["file"];
        bool canDownload = helper.HasPermission(FileOperation.Download, path);
        if (!canDownload)
        {
            context.Response.StatusCode = 403;
            context.Response.End();
            return;
        }
        else
        {
            context.Response.ContentType = "text/plain";
            context.Response.AppendHeader("Content-Disposition", path);
            context.Response.WriteFile(path);
            context.Response.TransmitFile(path);
            context.Response.End();
        }
    }

At my treeView I try make post to get file like this:

  <script type="text/javascript">

 function onNodeClick(sender, eventArgs) {

    var tree = $find("<%= tvFile.ClientID %>");
    var nodeValue = eventArgs.get_node().get_value();
    $.post("DownloadFile.ashx", { file: nodeValue });        
}

But there us no any dialog. Is it possible to get file by handler through js? What should I do to get saveDialog.