title: Why is HttpContext.Current null?
body: <p>I have a value that I use in all the application; I set this in application_start</p>
  
  <pre><code>  void Application_Start(object sender, EventArgs e)
    {
      Dictionary&lt;int, IList&lt;string&gt;&gt; Panels = new Dictionary&lt;int, IList&lt;string&gt;&gt;();
      List&lt;clsPanelSetting&gt; setting = clsPanelSettingFactory.GetAll();
      foreach (clsPanelSetting panel in setting)
      {
          Panels.Add(panel.AdminId, new List&lt;string&gt;() { panel.Phone,panel.UserName,panel.Password});
      }
      Application["Setting"] = Panels;
  
      SmsSchedule we = new SmsSchedule();
      we.Run();
  
    }
  </code></pre>
  
  <p>and in SmsSchedule </p>
  
  <pre><code>public class SmsSchedule : ISchedule
  {
      public void Run()
      {           
          DateTimeOffset startTime = DateBuilder.FutureDate(2, IntervalUnit.Second);
          IJobDetail job = JobBuilder.Create&lt;SmsJob&gt;()
              .WithIdentity("job1")
              .Build();
  
          ITrigger trigger = TriggerBuilder.Create()
               .WithIdentity("trigger1")
               .StartAt(startTime)
               .WithSimpleSchedule(x =&gt; x.WithIntervalInSeconds(60).RepeatForever())
               .Build();
  
          ISchedulerFactory sf = new StdSchedulerFactory();
          IScheduler sc = sf.GetScheduler();
          sc.ScheduleJob(job, trigger);
  
          sc.Start();
      }
  }
  </code></pre>
  
  <p>I want to get this value in a class.(smsjob)</p>
  
  <pre><code>   public class SmsJob : IJob 
     {  
        public virtual void Execute(IJobExecutionContext context)
        {
            HttpContext.Current.Application["Setting"]; 
        }
     }
  </code></pre>
  
  <p>but my problem is : HttpContext.Current is null, why is HttpContext.Current null?</p>
  
  <p><strong>Edit:</strong>
  When i use this code in another class of a page it works, but in this class I get the error.</p>