Asp.Net Response.BinaryWrite problem with SSL - How to fix

In some cases with SSL you can get error when download form browser stream file. This code works with SSL.

    public static void WriteExcelFileToResponse(HttpResponse Response, byte[] fileContent, string fileName)
        {
            SetExcelHeaders(Response, fileName);
            Response.BinaryWrite(fileContent);
            Response.End();
        }
    public static void SetExcelHeaders(HttpResponse Response, string fileName)

        {
            Response.Clear();
      
           Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", fileName));
    
           Response.ContentType = "application/vnd.ms-excel";

        }

<!--googleAd-->
I hope it can help you to save few hours of your time.

Comments

Hey man, It saves me a lot of time
thx

You can use simple HTML-formatting tags(like <b>, <ul>, <code> and others)

Wow free space!
Super hosting provider might be here!

Is it Google?