how do i pull masterpage content in the database and pass that in to the masterpage to ensure that my Sights gets from this? It is really an example:

Clients towards the website may have a distinctive code, allows refer to it as "TargetCode", for instance, ABC123, ABC456, etc... This excellent code is going to be joined within the querystring, for instance:

All of individuals "TargetCode" may have another CSS, title, address, telephone number, (present with all pages, so these is going to be put into the actual page) and page contents (around 2-3 pages, allows call thse pages Index, Items, and MoreInfo).

Then when I go to the website address,, first it'll consider the database, see if the code is available, if so, it pull the Masterpage information (css, title, address, telephone number) and employ that for that masterpage. I Quickly will pull the page contents (Index, Items, and MoreInfo) for that other Actions, each one of these pages is going to be utilizing the same masterpage content obviously.

Thanks greatly.

This is exactly what I am presently getting also it appears to operate, but I am unsure if this sounds like the right way to get it done:

public override void OnActionExecuted(ActionExecutedContext filterContext)
    HomeRepository hr = new HomeRepository();
    var result = filterContext.Result as ViewResult;
    if (result == null)

    string TargetCode = string.Empty;
    Controller control = filterContext.Controller as Controller;
    System.Collections.Specialized.NameValueCollection query = filterContext.HttpContext.Request.QueryString;

    if (query.Count > 0 && query["TargetCode"] != null && query["TargetCode"].ToString() != "")
    	TargetCode = query["TargetCode"].ToString();

    if (string.IsNullOrEmpty(TargetCode))
    	if (control != null) control.HttpContext.Response.Redirect("./NoCode");

    if (!hr.CheckTargetCodeExists(TargetCode))
    	if (control != null) control.HttpContext.Response.Redirect("./InvalidCode");
    var ThemeData = hr.GetMasterPageContent(TargetCode);
    result.ViewData["ThemeData"] = ThemeData;

Must I use OnActionExecuting() or OnActionExecuted()?

Your master can take inside a MasterPage System.Web.Mvc.ViewMasterPage.MasterViewModel and so i might have your controller call the model to obtain the assets you'll need after which bind the correct view according to your controller view calls.