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

  • Home
  • SEARCH
  • 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 604657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:03:43+00:00 2026-05-13T17:03:43+00:00

How do you modify a ASP.NET MVC 2.0 project to work with the Spark

  • 0

How do you modify a ASP.NET MVC 2.0 project to work with the Spark View Engine?

I tried like described here:
http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx

But somehow it still tries to route to .aspx files.

Here the code of my global.asax:

public class MvcApplication : System.Web.HttpApplication
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        );

    }

    protected void Application_Start()
    {
        SparkViewFactory svf = new SparkViewFactory();
        PrecompileViews(svf);

        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);
    }

    public static void PrecompileViews(SparkViewFactory svf)
    {
        var controllerFactory = svf;
        var viewFactory = new SparkViewFactory(controllerFactory.Settings);
        var batch = new SparkBatchDescriptor();
        batch
            .For<HomeController>()
            .For<AccountController>();
        viewFactory.Precompile(batch);
    }
}

}

  • 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-13T17:03:43+00:00Added an answer on May 13, 2026 at 5:03 pm

    http://www.simple-talk.com/community/blogs/asiemer/archive/2010/01/31/89132.aspx

    I had to download the spark view engine source code (http://sparkviewengine.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27600). Once I did that I went through each of the projects that had a reference to the 1.0 version of System.Web.Mvc assembly and updated to reference to point to System.Web.Mvc 2.0. From there you can build the solution (in visual studio) and you will find that a whole bunch of tests start to fail. You can attempt to fix them (by adding the additional TextWriter parameter you will find is now needed). You will also see that the SparkView.cs file complains about a missing parameter. In the Render method (line 100 of the source code I downloaded) I had to update the instantiation of the wrappedViewContext to look like this (add writer to the end of the list of parameters):

    public void Render(ViewContext viewContext, TextWriter writer)
    {
        var wrappedHttpContext = new HttpContextWrapper(viewContext.HttpContext, this);
    
        var wrappedViewContext = new ViewContext(
            new ControllerContext(wrappedHttpContext, viewContext.RouteData, viewContext.Controller),
            viewContext.View,
            viewContext.ViewData,
            viewContext.TempData,
            writer); //  <-- add the writer to the end of the list of parameters
    
        ...
    }
    

    Once the code is updated you can run the build.cmd script that is in the root of the source you downloaded. The build process will create a zip file in the build/dist folder. Take those new dll’s and add them to your website. Things should work once again.

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

Sidebar

Related Questions

I am currently using the EntityFramework to bind my ASP.NET MVC project to a
All, I'm starting a new ASP.NET MVC project which requires some content management capabilities.
I am working with couple of friends on an ASP.NET MVC website. The project
I have an asp.net mvc 2.0 application that contains Areas/Modules like calendar, admin, etc...
Currently I have an Area in my ASP.NET MVC 2 project call 'API', which
There's so much I'm enjoying with asp.net MVC 2...but sometimes I feel like I'm
Example is fake. ASP.NET MVC: I have a view that renders a student info.
I am playing with learning ASP.NET MVC as a non-web developer. I am trying
I am working on an ASP.NET MVC web application, and am working on the
How to modify the server values of response header through code behind using asp.net

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.