0

Am saving Webpages from webbrowser control to the directory like below code. Now i want to check all the webpages daily that is modified or not. if it is modified have to update or else leave it.

 long size = CalculateDirectorySize(dir, true);         
           mb = (size) / (1024 * 1024);            
        var filename1 = webBrowser1.Document.Title;

        var path1 = (@"D:\Cache\" + filename1 + ".html");
        if (mb != 1)
        {
            if (File.Exists(path1))
            {
                MessageBox.Show("Exist");
            }
            else
            {
                File.WriteAllText(path1, webBrowser1.Document.Body.Parent.OuterHtml, Encoding.GetEncoding(webBrowser1.Document.Encoding));
                MessageBox.Show("Saved");
            }
        }
        else
        {

          DialogResult dialogResult = MessageBox.Show("Cache Full!!  Want to Continue","Confirm", MessageBoxButtons.YesNo);
          if (dialogResult == DialogResult.Yes)
          {
              DirectoryInfo source = new DirectoryInfo("D:\\Cache");

              // Get info of each file into the directory
              foreach (FileInfo fi in source.GetFiles())
              {
                  var creationTime = fi.CreationTime;

                  if (creationTime < (DateTime.Now - new TimeSpan(7, 0, 0, 0)))
                  {
                      fi.Delete();
                      File.WriteAllText(path1, webBrowser1.Document.Body.Parent.OuterHtml, Encoding.GetEncoding(webBrowser1.Document.Encoding));
                  }



              }
              MessageBox.Show("Least Recently Used File Deleted And Saved New File");


          }
          else if (dialogResult == DialogResult.No)
          {
              MessageBox.Show("Thankyou","Alert");
          }

now i want to check (modified since header) of all the webpages stored in D:\Cache Daily. If it is modified haveto update and save the same folder. please any one explain me how to do and give solution.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Deena
  • 31
  • 1
  • 3
  • Please don't just ask us to solve the problem for you. Show us how _you_ tried to solve the problem yourself, then show us _exactly_ what the result was, and tell us why you feel it didn't work. See "[What Have You Tried?](http://whathaveyoutried.com/)" for an excellent article that you _really need to read_. – John Saunders May 29 '15 at 06:37
  • sure i can show u what i hav tried.. – Deena May 29 '15 at 07:14
  • Ok, where are you checking the header? – John Saunders May 29 '15 at 07:33
  • sure i can show u what i have tried.. but You the people give the comments like this will discourage us like freshers. http://stackoverflow.com/questions/30525491/since-modified-header-in-c-sharp – Deena May 29 '15 at 09:06
  • Comments like this are intended to tell you what you need to do in order to get an answer to your question. – John Saunders May 29 '15 at 09:54

0 Answers0