title: ASP.NET XMLHTTPREQUEST download file using Handler
body: <p>am trying to implement file download using xmlhttprequest... But am not getting the file dialog or any response. I have debug the handler, no error.</p>
  
  <pre><code>   function download(id)
      {
      try 
      {
          var xmlHttp=new XMLHttpRequest();
          xmlHttp.open("GET","DownloadFileHandler.ashx?id=" + id,false);       
          xmlHttp.send();
             xmlHttp.onreadystatechange=function()
      {
          //if request has been entertained and response is returned from server
          if(xmlHttp.readyState==4)
         {       
            alert("aq");
  
          }
      }
  }
  
  
  
      catch (ex)
      {
      alert("Browser does not support ajax");
      }
  
      }
  }
  </code></pre>
  
  <p>my handler</p>
  
  <pre><code>context.Response.AppendHeader("content-disposition", "attachment; filename=" + name);
  context.Response.ContentType = type;
  context.Response.WriteFile(path);
  context.Response.End();    
  </code></pre>