Try our conversational search powered by Generative AI!

crli
Sep 8, 2010
  5966
(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
Why C# Developers Should Embrace Node.js

Explore why C# developers should embrace Node.js especially with Optimizely's SaaS CMS on the horizon. Understand the shift towards agile web...

Andy Blyth | May 2, 2024 | Syndicated blog

Is Optimizely CMS PaaS the Preferred Choice?

As always, it depends. With it's comprehensive and proven support for complex business needs across various deployment scenarios, it fits very well...

Andy Blyth | May 2, 2024 | Syndicated blog

Adding market segment for Customized Commerce 14

Since v.14 of commerce, the old solution  for adding market segment to the url is not working anymore due to techinal changes of .NET Core. There i...

Oskar Zetterberg | May 2, 2024

Blazor components in Optimizely CMS admin/edit interface

Lab: Integrating Blazor Components into Various Aspects of Optimizely CMS admin/edit interface

Ove Lartelius | May 2, 2024 | Syndicated blog

Anonymous Tracking Across Devices with Optimizely ODP

An article by Lead Integration Developer, Daniel Copping In this article, I’ll describe how you can use the Optimizely Data Platform (ODP) to...

Daniel Copping | Apr 30, 2024 | Syndicated blog

Optimizely Forms - How to add extra data automatically into submission

Some words about Optimizely Forms Optimizely Forms is a built-in add-on by Optimizely development team that enables to create forms dynamically via...

Binh Nguyen Thi | Apr 29, 2024