Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3699456
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:06:18+00:00 2026-05-19T05:06:18+00:00

I use Spark View Engine with nested master pages. I have Application.spark which defines

  • 0

I use Spark View Engine with nested master pages. I have Application.spark which defines the basic layout of the website. Then there are several other masters which themselves use Application.spark as master page (Default.spark, SinlgeColumn.spark, Gallery.spark, …)

If no master page is specified in a view file, then automatically Application.spark is choosen by the Spark View Engine. Since almost all my pages use “Default.spark” as master, is there a way to configure this globally?

The other possibilities would be:

  1. Set the master in each spark file individually <use master="Default" />. But that’s really annoying.

  2. Rename my master files (Default.spark <-> Application.spark) but that really doesn’t make any sense in naming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:06:18+00:00Added an answer on May 19, 2026 at 5:06 am

    There are two ways to solve your issue:

    1. Less work – but more repetitive.
    2. More work, but drives out your preferred convention.

    Less Work

    With any ActionResult, you can simply add a second parameter to the return statement to specify the name of the master to use:

    return View("Gallery", "Default");
    

    the first parameter name is the view and the second signifies a master page override…but that does mean you need to repeat it everywhere, and this isn’t much better than what you had before.

    More Work

    The way that Spark locates the master page to use is via the following code in the framework:

    protected virtual IEnumerable<string> PotentialDefaultMasterLocations(string controllerName, IDictionary<string, object> extra)
        {
            return ApplyFilters(new[]
                                    {
                                        "Layouts\\" + controllerName + ".spark",
                                        "Shared\\" + controllerName + ".spark",
                                        "Layouts\\Application.spark",
                                        "Shared\\Application.spark"
                                    }, extra);
        }
    

    Notice the hardcoded Application.spark in there – that’s a Spark convention. What it seems that you want to do is override this method and put something like this in instead:

    protected virtual IEnumerable<string> PotentialDefaultMasterLocations(string controllerName, IDictionary<string, object> extra)
        {
            return ApplyFilters(new[]
                                    {
                                        "Layouts\\" + controllerName + ".spark",
                                        "Shared\\" + controllerName + ".spark",
                                        "Layouts\\Default.spark",
                                        "Shared\\Default.spark"
                                        "Layouts\\Application.spark",
                                        "Shared\\Application.spark"
                                    }, extra);
        }
    

    Then it will find your Default.spark before it finds Application.spark or you could get rid of the Application.spark entirely if it doesn’t ring true for you and you prefer your conventions…

    In order to override this, all you need to do is create a class that inherits from Spark.Web.Mvc.DefaultDescriptorBuilder and override that method mentioned above and use it when you register the view engine like so:

    public static void RegisterViewEngine(ICollection<IViewEngine> engines)
    {
        var services = SparkEngineStarter.CreateContainer();
        services.SetServiceBuilder<IDescriptorBuilder>(
            c => new MyDescriptorBuilder());
        SparkEngineStarter.RegisterViewEngine(services);
    }
    

    This now means that you can now direct where Spark should look for the Master views and what the names will be.

    Hope that helps,
    All the best,
    RobertTheGrey

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use new spark view engine . i have done all
I'm attempting to use fluent html and the spark view engine in my asp.net
I decided to use ASP.NET MVC, S#arp Architectur and the Spark View Engine for
I'm using the spark view engine with my asp.net mvc application. In my aspx
I've been using the spark view engine bindings and I have a problem with
I was going through the spark view engine documentation and found a lot of
I've heard or read somewhere (can't recall where) that the spark view engine supports
I have 2 spark labels next to each other. They are in a basic
I've been using the Bindings feature with the spark view engine to replace quite
I have the Spark scroll bar in my application skinned the way I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.