Exception "The remote host closed the connection. The error code is 0x800703E3."

0
    try
    {
        int _quarterId = 0;
        if (id != null)
        {
            _quarterId = (int)id;
        }
        else
        {
            _quarterId = Utility.GetQuarterIdFromSession();
        }

        int _businessId = Utility.GetBusinessIdFromSession();

        if (_quarterId > 0 && _businessId > 0)
        {
            Return _return = _engineService.GetFormPdf(_quarterId, _businessId);
            if (_return != null && _return.FormPDF != null &&
                _return.FormPDF.Length > 0)
            {
                Response.Clear();
                Response.Buffer = false;
                Response.AddHeader("Accept-Header", _return.FormPDF.Length.ToString());
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename= FormPdf.pdf");
                Response.AddHeader("content-length", _return.FormPDF.Length.ToString());
                Response.BinaryWrite(_return.FormPDF);
                Response.Flush();
            }
        }
    }
    catch (ThreadAbortException)
    {

    }
    //This sets empty content and avoids the exception in changing the HTTP header
    return new EmptyResult();
}
c#
.net
asp.net-mvc-2
asked on Stack Overflow Feb 15, 2011 by yogeswaran K • edited Feb 15, 2011 by Vijay Sirigiri

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0