I need to fill HttpContext.Current.Application["Translations"]
on OWIN startup, but HttpContext.Current
is null
there.
Should I use Application_Start()
in Global.asax.cs
or it is bad idea?
What alternatives do I have?
HttpContext
is not available at start up as it cannot exist without a request. The Startup class only runs once for the application, not for each request.
Try accessing it in the BeginRequest
handler in Global.asax.cs
.
protected void Application_BeginRequest(object sender, EventArgs e) {
base.Application["Translations"] = "My value here";
}