title: ASP.NET MVC: How to create a usable UrlHelper instance?
body: <p>I am using quartz.net to schedule regular events within asp.net mvc application.</p>
  
  <p>The scheduled job should call a service layer script that requires a UrlHelper instance (for creating Urls based on correct routes (<code>via urlHelper.Action(..)</code>) contained in emails that will be sent by the service).</p>
  
  <p>I do not want to hardcode the links into the emails - they should be resolved using the urlhelper.</p>
  
  <p>The job:</p>
  
  <pre><code>public class EvaluateRequestsJob : Quartz.IJob
  {
      public void Execute(JobExecutionContext context)
      {
          //  where to get a usable urlHelper instance?
          ServiceFactory.GetRequestService(urlHelper).RunEvaluation();
      }
  }
  </code></pre>
  
  <p><b>Please note that this is not run within the MVC pipeline. There is no current request being served, the code is run by the Quartz scheduler at defined times.</b></p>
  
  <p>How do I get a UrlHelper instance usable on the indicated place?</p>
  
  <p>If it is not possible to construct a UrlHelper, the other option I see is to make the job "self-call" a controller action by doing a HTTP request - while executing the action I will of course have a UrlHelper instance available - but this seems a little bit hacky to me.</p>