views:

130

answers:

1

Ok big problem as this is affecting two projects on our new server. We have a file that is downloaded by users, the files are downloaded using a HTTPHandler. Since moving the site to the server and setting SSL the downloads have stopped working and we get an error message "Unable to download DownloadDocument.ashx" from site". DownloadDocument.ashx is the handler page that is set in the web.config and the button that goes there is a hyperlink with the id of the document as a querystring. Ive read the article on http://support.microsoft.com/kb/316431 and read a few other requests on this site but nothing seems to be working. This problem only happens in IE and works fine when I run it on the server in http instead of https.

      public override void HandleRequest(HttpContext context)
    {
        Guid guid = new Guid(context.Request.QueryString["ID"]);

        DataTable dt = Documents.GetDocument(guid);
        if (dt != null)
        {
            context.Response.Cache.SetCacheability(HttpCacheability.Private);

            context.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", dt.Rows[0]["DocumentName"].ToString()));
            context.Response.AddHeader("Content-Transfer-Encoding", "binary");
            context.Response.AddHeader("Content-Length", ((byte[])dt.Rows[0]["Document"]).Length.ToString());
            context.Response.ContentType = string.Format("application/{0}", dt.Rows[0]["Extension"].ToString().Remove(0, 1));

            context.Response.Buffer = true;

            context.Response.BinaryWrite((byte[])dt.Rows[0]["Document"]);
            context.Response.Flush();
            context.Response.End();
        }
    }

The above is my current code for the request. Ive used the base handler on http://haacked.com/archive/2005/03/17/AnAbstractBoilerplateHttpHandler.aspx. Any ideas on what this might be and how we can fix it.

Thanks in advance for all responses.

A: 

Fixed it using the advice here http://www.gidforums.com/t-12283.html.

Chiefy