title: How to stop current job and start new job use quartz.net in asp.net mvc?
body: <p>I've made a crawler on a website it has to read a website and fetch some values from it website.I've made use quartz.net and Asp.net MVC. but what is my problem? in fact,My problem is that for example,he/she the first time start for scraping a <code>"Stackoverflow.com"</code> about 5 hours and then he/she is decided stop <code>"stackoverflow.com"</code> and start a scrap new website.So,How can i do it?</p>
  
  <p><a href="https://i.stack.imgur.com/jjHyn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jjHyn.png" alt="enter image description here"></a></p>
  
  <pre><code>   [HttpPost]
      public ActionResult Index(string keyword, string url)
      {
          IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
  
          scheduler.Start();
          IJobDetail job = JobBuilder.Create&lt;ScrapJob&gt;()
              .WithIdentity("MyScrapJob")
              .UsingJobData("url", url)
              .UsingJobData("keyword", keyword)
              .Build();
  
          ITrigger trigger = TriggerBuilder.Create().WithDailyTimeIntervalSchedule(
              s =&gt; s.WithIntervalInSeconds(20).OnEveryDay().StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
              ).Build();
          scheduler.ScheduleJob(job, trigger);
  
          return View(db.Scraps.ToList());
      }
  </code></pre>
  
  <hr>
  
  <pre><code> public List&lt;ScrapJob&gt; Scraping(string url, string keyword)
      {
          int count = 0;
          List&lt;ScrapJob&gt; scraps = new List&lt;ScrapJob&gt;();
          ScrapJob scrap = null;
          HtmlDocument doc = new HtmlDocument();
          try
          {
              var request = (HttpWebRequest)WebRequest.Create(url);
              request.Method = "GET";
  
              using (var response = (HttpWebResponse)request.GetResponse())
              {
  
                  using (var stream = response.GetResponseStream())
                  {
                      doc.Load(stream, Encoding.GetEncoding("UTF-8"));
                      foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//text()"))
                      {
                          if (node.InnerText.ToString().Contains(keyword))
                          {
                              count++;
                              scrap = new ScrapJob { Keyword = keyword, DateTime = System.DateTime.Now.ToString(), Count = count, Url = url };
                          }
  
                      }
  
                  }
              }
          }
          catch (WebException ex)
          {
              Console.WriteLine(ex.Message);
          }
          //  scraps.Add(scrap);
          var isExist = db.Scraps.Where(s =&gt; s.Keyword == keyword &amp;&amp; s.Count == scrap.Count).Max(s =&gt; (int?)s.Id) ?? 0;
          if (isExist == 0)
          {
              db.Scraps.Add(scrap);
              db.SaveChanges();
          }
  
  
  
          return scraps;
      }
  
      public void Execute(IJobExecutionContext context)
      {
          //ScrapJob scraps = null;
          using (var scrap = new ScrapJob())
          {
              JobKey key = context.JobDetail.Key;
              JobDataMap dataMap = context.JobDetail.JobDataMap;
              string url = dataMap.GetString("url");
              string keyword = dataMap.GetString("keyword");
              scrap.Scraping(url, keyword);
          }
      }
  </code></pre>