title: Response.OutputStream.Flush() - not responding
body: <p>I am streaming a video using handler (ashx) file, </p>
  
  <p>Get video file stream and Writing bytes using outputstream in while loop,
  But received bytes is zero only until the while loop complete.</p>
  
  <pre><code>public class VideoHandler : IHttpHandler
  {
      public void ProcessRequest(HttpContext context)
      {
  
          System.Net.WebRequest wreq;
          System.Net.HttpWebResponse wresp;
          try
          {
              HttpRequest Request = context.Request;
  
              string OrginalUrl = GetURL();
  
              wreq = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(OrginalUrl);
              wreq.Timeout = 1000 * 60 * 60;
              wresp = (System.Net.HttpWebResponse)wreq.GetResponse();
  
  
              using (Stream mystream = wresp.GetResponseStream())
              {
  
                  int length = Convert.ToInt32(wresp.ContentLength);
  
                  context.Response.Clear();
                  context.Response.Buffer = false;
                  context.Response.BufferOutput = false;
  
                  context.Response.AddHeader("Content-Type", "application/octet-stream");
                  context.Response.AddHeader("Content-Length", length.ToString());
  
                  byte[] buffer = new byte[512];
  
                  if (context.Response.IsClientConnected)
                  {
                      while (mystream.CanRead)
                      {
                          int bytesRead = mystream.Read(buffer, 0, buffer.Length);
                          if (bytesRead == 0) break;
  
                          context.Response.OutputStream.Write(buffer, 0, bytesRead);
                          context.Response.OutputStream.Flush();
                          context.Response.OutputStream.Close();
                      }
                  }
  
  
                  String DateValue = DateTime.Now.ToString();
  
                  mystream.Close();
              }
  
          }
          catch (Exception e)
          {
          }
          finally
          {
              wresp = null;
              wreq = null;
          }
      }
  }
  </code></pre>
  
  <p>This is my handler file, What I am missing here?</p>
  
  <p>This my HTML</p>
  
  <pre><code>&lt;video id="videoPlayer1" class="video-js vjs-default-skin" preload="metadata" controls="controls" width="700" height="500"
                      data-height="500" autoplay="autoplay" &gt;
                      &lt;source id="source1" src="Handlers/VideoHandler.ashx" type="video/mp4" /&gt;
                  &lt;/video&gt;
  </code></pre>
  
  <p>Thanks</p>