I would like to add the following code in global asax file since we cannot use OWIN in our ASP.Net Webforms app. This code needs to go into Application_Start
event.
Question :What will be the corresponding code for using in Application_Start
event of global asax
?
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Map Dashboard to the `http://<your-app>/hangfire` URL.
app.UseHangfireDashboard();
}
}
Hello,
You may use the following code in your global.asax to setup the job server but you won’t be able to use the dashboard without OWIN.
using Hangfire;
using System;
namespace WebAPI
{
public class Global : System.Web.HttpApplication
{
private BackgroundJobServer _backgroundJobServer;
protected void Application_Start(object sender, EventArgs e)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("<hangfire connection string>");
_backgroundJobServer = new BackgroundJobServer();
}
protected void Application_End(object sender, EventArgs e)
{
_backgroundJobServer.Dispose();
}
}
}
and something like app.UseHangfire or config.UseAuthorizationFilters how could be moved from startup to global asax?
Believe it or not. i need a solution to this now. I managed to bypass OWIN Startup so far but I just cannot figure out this Dashboard thin now. and I cannot just switch to OWIN. I need to enable Dashboard with custom Basic username/password protection and NOT affect the site’s SSO authentication and filter already setup.