title: Save to local drive
body: <p>I had done a task in which the csv files can be selected using calendar and download form FTP.</p>
  
  <p>At present I had predefined the local drive path to save the csv files.</p>
  
  <p>I need to show pop for save as then the user has to save to any location as they need.</p>
  
  <pre><code>private void Download()
  {
    System.DateTime myDate = new System.DateTime();
    myDate = caldownload.SelectedDate;
    System.DateTime myDate1 = new System.DateTime();
    myDate1 = Calendar1.SelectedDate;
    string sdate;
    string edate;
    TextBox1.Text = myDate.ToString("yyyy-MM-dd");
    TextBox2.Text = myDate1.ToString("yyyy-MM-dd");
    DateTime d1 = myDate.Date;
    DateTime d2 = myDate1.Date;
    TimeSpan sum = d2 - d1;
  
    int NrOfDays = sum.Days;
    NrOfDays++;
  
    int k = NrOfDays;
    string[] fileName = new string[k];
  
    //increment for days
    int s = myDate.Day;
  
    FtpWebRequest reqFTP;
    try
    {
      if (NrOfDays&lt;=7)
      {
        for (k = 0; k &lt;= NrOfDays; k++)
        {
          fname[i] = myDate.ToString("yyyy-MM-dd");
          fileName[k] = myDate.ToString("yyyy-MM-dd");
  
          //files to save local drive
          FileStream outputStream = new FileStream("F:\\ch" + "\\" + fname[i]+".csv", FileMode.Create);
          reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + "192.162.1.152" + "//" + "[100]" + "//" + fileName[k] + ".csv"));
  
          reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
          reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
          reqFTP.UseBinary = true;
          reqFTP.Credentials = new NetworkCredential("", "");
          FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
  
          Stream ftpStream = response.GetResponseStream();
          long cl = response.ContentLength;
          int bufferSize = 2048;
          int readCount;
          byte[] buffer = new byte[bufferSize];
  
          readCount = ftpStream.Read(buffer, 0, bufferSize);
          while (readCount &gt; 0)
          {
            outputStream.Write(buffer, 0, readCount);
            readCount = ftpStream.Read(buffer, 0, bufferSize);
          }
  
          myDate = myDate.AddDays(1);
  
          ftpStream.Close();
          outputStream.Close();
          response.Close();
        }
      }
      else
      {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('You are allowed to download files for maximum of 7 days .');location.href = 'Default.aspx';", true);
      }
    }
    catch (Exception ex)
    { }
  }
  </code></pre>