title: webexception unhandled by usercode, ioexception-the device is not ready when viewing pdf or image file
body: <p>I have a code which reads the pdfpath and displays in the new popupwindow, 
  here is my code</p>
  
  <pre><code>string path = Request.QueryString["val"].ToString();
  string extention = Path.GetExtension(path);
  int len = extention.Length - 1;
  string extwithoutdot = extention.Substring(1, len);
  
  if (extwithoutdot.Equals("JPG") || 
      extwithoutdot.Equals("jpg") || 
      extwithoutdot.Equals("jpeg") || 
      extwithoutdot.Equals("JPEG"))
  {
      extwithoutdot = "jpeg";
  }
  if (extwithoutdot.Equals("TIF") || extwithoutdot.Equals("tif"))
  {
      extwithoutdot = "tiff";
  }
  if (extwithoutdot.Equals("GIF") || extwithoutdot.Equals("gif"))
  {
      extwithoutdot = "gif";
  }
  if (extwithoutdot.Equals("BMP") || extwithoutdot.Equals("bmp"))
  {
      extwithoutdot = "bmp";
  }
  
  
  
  string filetype = "";
  if (extention.Equals(".pdf") || extention.Equals(".PDF"))
  {
      extwithoutdot = "pdf";
      filetype = "PDF";
  }
  
  WebClient client = new WebClient();
  //driveInfo.IsReady;
  Byte[] buffer = client.DownloadData(path);
  </code></pre>
  
  <p>am getting the error as device is not ready
  how to resolve this issue?</p>