Access Web.Config section from HangFire Job

Hi
I need access to Email section from HangFire job to send emails.
Can anyone suggest me what is best way to do this?

I have two alternatives for you:

  1. Let the hangfire server have its own email settings, e.g. In app.config.
  2. Pass the relevant settings as parameters to the job when it is scheduled.

What happened to the good old ConfigurationManager.AppSettings[...] ?? That will automatically read from your applications configuration file - for web applications, that is the web.config.

The app processing hangfire jobs doesn’t have to be the same app that created the jobs. Multiple apps can create jobs in the same queue. It’s easier to explicitly pass this information through as parameters than to create some sort of “context portability” shim.