I have a number of Controllers, and I want them all to have an interface to a PageConfiguration
object that needs to be created based on the URL. I'm not sure how to do this other than to create the interface in the action methods, because they have access to Request.QueryString
, where the Controllers constructors don't. Do I need to create a global object in Application_BeginRequest
? What approaches could I take to satisfy this requirement? Thanks
edit: this code outlines what I'm trying to do:
public class ResultsController : Controller
{
private IPageConfiguration page;
public ResultsController()
{
page = new PageConfiguration("?"); // needs value from query string
}
}
public class FactsheetController : Controller
{
private IPageConfiguration page;
public FactsheetController()
{
page = new PageConfiguration("?"); // needs value from query string
}
}