title: Why the httpwebresponse ContentType is empty all the time ? Or most of the times
body: <p>I'm not getting any exceptions but most of the times now this line:</p>
  
  <pre><code>if (response.ContentType == "") 
  </code></pre>
  
  <p>most of the times the ContentType is empty it's ""</p>
  
  <p>My question is why ? And if there is any way to solve it ?
  My program every 5 minutes downloading a file using this method.</p>
  
  <p>This is how i call the method:</p>
  
  <pre><code>fileDownloadRadar(remote_image_on_server, combinedTemp);
  </code></pre>
  
  <p>remote_image_on_server is a string and contain: <a href="http://www.ims.gov.il/Ims/Pages/RadarImage.aspx?Row=9&amp;TotalImages=10&amp;LangID=1&amp;Location=" rel="nofollow">http://www.ims.gov.il/Ims/Pages/RadarImage.aspx?Row=9&amp;TotalImages=10&amp;LangID=1&amp;Location=</a></p>
  
  <p>combinedTemp is also a string: c:\test\test.gif</p>
  
  <p>And this is the method:</p>
  
  <pre><code>HttpWebRequest request;
          int currentIndex = 0;
          void fileDownloadRadar(string uri, string fileName)
          {
              if (splash != null)
              {
                  if (!splash.IsDisposed)
                      splash.UpdateProgressBar(0);
              }
              try
              {
                  request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
                  request.CookieContainer = new CookieContainer();
                  request.AllowAutoRedirect = true;
                  using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                  {
  
                      long contentLength = response.ContentLength;
                      if (response.ContentType == "")
                      {
                          Logger.Write("ContentType is Empty download was not fine !!!!!");
                      }
                      if ((response.StatusCode == HttpStatusCode.OK ||
                          response.StatusCode == HttpStatusCode.Moved ||
                          response.StatusCode == HttpStatusCode.Redirect) &amp;&amp;
                          response.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase))
                      {
                          Logger.Write("ContentType is not empty meaning download is fine");
                          using (Stream inputStream = response.GetResponseStream())
                          using (Stream outputStream = File.OpenWrite(fileName))
                          {
                              byte[] buffer = new byte[4096];
                              int bytesRead;
                              do
                              {
                                  bytesRead = inputStream.Read(buffer, 0, buffer.Length);
                                  currentIndex += bytesRead;
                                  double percentage = (double)currentIndex / contentLength;
                                  if (splash != null)
                                  {
                                      if (!splash.IsDisposed)
                                          splash.UpdateProgressBar((int)(percentage * 100));
                                  }
                                  outputStream.Write(buffer, 0, bytesRead);
                              } while (bytesRead != 0);
                              if (splash != null)
                              {
                                  if (!splash.IsDisposed)
                                  {
                                      splash.UpdateProgressBar(100);
                                  }
                              }
                          }
  
                      }
                      else
                      {
                          timer1.Stop();
                          timer3.Start();
                      }
                      if (splash == null)
                          FinishWebRequest();
                  }
              }
              catch (WebException ex)
              {
                  if (ex.Status == WebExceptionStatus.Timeout)
                  {
                      Logger.Write(ex.Status.ToString());
                  }
              }
          }
  </code></pre>