[Mono-aspnet-list] MVC 3 App Cannot Find Template
Daniel J. Summers
daniel.summers.2415 at gmail.com
Tue Mar 15 22:46:59 EDT 2011
On Tue, Mar 15, 2011 at 2:54 PM, Carl Hörberg <carl.hoerberg at gmail.com>wrote:
> it works in both environments :)
>
This didn't seem to fix it. Still works fine on Windows, but still throws
the error in Mono. (Even did clean/build and restarted Apache to flush the
compiled cache.) Here's my Global.asax.cs - did I mess something up on the
copy?
namespace VPR {
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
/// <summary>
/// Override to support Mono
/// </summary>
public class MonoWebFormViewEngine : WebFormViewEngine {
protected override bool FileExists(ControllerContext
controllerContext, string virtualPath) {
return base.FileExists(controllerContext,
virtualPath.Replace("~", ""));
}
}
/// <summary>
/// Override to support Mono
/// </summary>
public class MonoRazorViewEngine : RazorViewEngine {
protected override bool FileExists(ControllerContext
controllerContext, string virtualPath) {
return base.FileExists(controllerContext,
virtualPath.Replace("~", ""));
}
}
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication {
public static void RegisterGlobalFilters(GlobalFilterCollection
filters) {
filters.Add(new HandleErrorAttribute());
}
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 =
UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start() {
// Put Mono-supporting view engines in the context
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new MonoWebFormViewEngine());
ViewEngines.Engines.Add(new MonoRazorViewEngine());
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
}
--
*Daniel J. Summers*
*Owner, DJS Consulting*
E-mail <daniel.summers.2415 at gmail.com> • Website <http://djs-consulting.com>
• Support <http://support.djs-consulting.com> • Tech
Blog<http://techblog.djs-consulting.com>
GEEKCODE 3.12 GCS/IT d s-:+ a C++ P--- L++ E--- W++ N++ o? K- w !O M--
V PS+ PE++ Y? PGP- t+ 5? X+ R* tv b+ DI++ D+ G- e<++ h---- r+++ y++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20110316/2d82ae25/attachment.html
More information about the Mono-aspnet-list
mailing list