Search code examples
asp.net-mvcasp.net-mvc-5hangfire

How to apply layout page to Hangfire dashboard?


How to keep menus and other site context elements when presenting Hangfire dashboard?

I am using Hangfire nuget package in my MVC 5 project.


Solution

  • The solution i encounter was to include the HangFire Dashboard in a view page, using iframe. The BackToSite button, called from the inside the iframe, causes the site to be render inside the iframe. It can be removed at OwinStartup by setting it to null like this:

    app.UseHangfireDashboard("/hangfire", new DashboardOptions
    {
       AppPath = null,              
    });
    

    To apply the site theme to the dashboard can be done by creating a new PageView using Hangfire library, as show here, but requires much more effort.