title: need to call an web service in a specific time with c# asp.net
body: <p>I have created an email function in web service, I need to call the function and sent the email out everyday in 18.30. How do I able to detect the time of my current system and call the web service according to the time. I have tried the infinite loop method to compare the time, it works but somehow I think it is not a correct way.</p>
  
  <pre><code>while (1 == 1)
          {
  
              DateTime dtNowTime = DateTime.Now;
              if (dtNowTime.Hour == 18 &amp;&amp; dtNowTime.Minute == 30)
              {
  
                  int status = 0;
                  status = sending.HelloWorld();
                  if (status == 1)
                  {
                      Response.Write("&lt;script&gt;alert('Success');&lt;/script&gt;");
                  }
                  else
                  {
  
                      Response.Write("&lt;script&gt;alert('Fail');&lt;/script&gt;");
                  }
  
              }
  
          }
  </code></pre>
  
  <p>This is the method I tried so far, is that a better way to achieve this? </p>