Try our conversational search powered by Generative AI!

crli
Sep 8, 2010
  5973
(1 votes)

Don’t even try using MVC2 on CMS6

...yet. Unfortunately it’s not possible to use ASP.NET MVC 2 on CMS6 (without running into a lot of trouble). The reason is that parts of EPiServer uses MVC1 and there are breaking changes between MVC1 and MVC2 preventing a simple assembly redirect.

The offending changes

The particlar changes that cause problems in this case are these:

  • Http GET and return Json needs to be explicitly allowed in code return Json(…, JsonRequestBehavior.AllowGet);
  • Change of return type to MvcHtmlString on html helpers
  • Async controllers feature introduces a new way of calling the controller factory

Future upgrades of ASP.MVC

Now, if you’re using MVC1 please be aware that we’re planning to update ASP.NET MVC to version 2 and that you might be affected by changes above, or any of the other changes described in the ASP.NET MVC 2 RTM release notes 

I’ve heard several requests to use MVC the second. If you feel this upgrade might be a problem don’t hesitate to add your comment below.

Sep 08, 2010

Comments

Staffan Eketorp
Staffan Eketorp Sep 21, 2010 10:33 AM

We're using MVC2 and would REALLY like to see support

Kind regards

Christian Landgren
Christian Landgren Nov 10, 2010 02:02 PM

We will try to use MVC2 disregarding your strong recommendation to do otherwise, the reason is that we will use a AJAX framework that will need to communicate with episerver through JSON and we will rather use the MVC2 framework for doing this rather than to depend on a third party library for that.

Will Episerver 6 R2 have support for MVC2?

We would love to take part of any progress that you have made so far in solving the issues you describe and others that we already have noticed when trying to combine the two versions.

Carl-Johan Berg
Carl-Johan Berg Nov 11, 2010 08:06 PM

I’m afraid the only way to get a fully functional CMS 6.0 site using MVC 2.0 is to use a custom MVC 2.0 build (or better yet, a 3.0 build). As Cristian mentions, there are three breaking changes.

Number one (GET/JSON result) and three (async controller support) can be worked around pretty easily using a dynamic proxy, wrapping and correcting the offending implementations. Number two, however, is a binary incompatibility that you really can’t work around, unless you’re prepared to hack some assemblies and register them for signature verification skipping (not a very comfortable solution, IMHO).

My team is successfully using a custom build, and everything is working just fine. The only drawback is having to rebuild 3rd-party assemblies that have a dependency on MVC (for instance Autofac). So far it hasn’t been a big obstacle, especially since we avoid closed-source dependencies as much as possible. YMMV, of course.

@Cristian Libardo: I’d be really happy if you would go the extra mile to break the hard dependency on a specific MVC version (and hey, maybe that awful old thing called log4net – NLog FTW!). There are several ways to achieve it, and you’ll end up with a less rigid framework. A win for everyone!

Nov 16, 2010 09:50 PM

@Christian: Yes!
@Carl-Johan: That's one clever solution. I think MVC is stabilizing and don't expect any breaking changes in MVC vNext. Can you elaborate what you mean about removing dependency on the MVC version?

Please login to comment.
Latest blogs
Upgrade Optimizely CMS From v11 to v12

Why Upgrade? There are many improvements implemented in version 12, but most importantly is that the whole framework is migrated from .Net Framewor...

MilosR | May 13, 2024

Configured Commerce - Infrastructure Updates Ahoy!

I'm very happy to share an important milestone - we no longer have any customers in our legacy v1 environment!  This means that the Configured...

John McCarroll | May 10, 2024

A day in the life of an Optimizely Developer - Enabling Opti ID within your application

Hello and welcome to another instalment of A Day In The Life Of An Optimizely developer, in this blog post I will provide details on Optimizely's...

Graham Carr | May 9, 2024

How to add a custom property in Optimizely Graph

In the Optimizely CMS content can be synchronized to the Optimizely Graph service for it then to be exposed by the GraphQL API. In some cases, you...

Ynze | May 9, 2024 | Syndicated blog

New Security Improvement released for Optimizely CMS 11

A new security improvement has been released for Optimizely CMS 11. You should update now!

Tomas Hensrud Gulla | May 7, 2024 | Syndicated blog

Azure AI Language – Key Phrase Extraction in Optimizely CMS

In this article, I demonstrate how the key phrase extraction feature, offered by the Azure AI Language service, can be used to generate a list of k...

Anil Patel | May 7, 2024 | Syndicated blog