Can I run a MVC 1 application using the MVC 2 assemblies without a hitch? I understand that some 3rd party tools have had stuff broken in MVC 2, but let's assume I'm not using those any other tools.
There have been breaking changes.
If you want a 1.0 project to run on 2.0, it does look for things in different places; so you'd have to migrate the application to 2.0..
Here are the changes that could possibly 'break' (current as of Preview 2):
Changes in Preview 2
MvcHtmlString
objectIn order to take advantage of the new HTML-encoding expression syntax in ASP.NET 4, the return type of the HTML helpers is now MvcHtmlString
instead of a string
. Note that if you use ASP.NET MVC 2 and the new helpers with ASP.NET 3.5, you will not be able to take advantage of the HTML-encoding syntax; the new syntax is available only when you run ASP.NET MVC 2 on ASP.NET 4.
JsonResult
now responds only to HTTP POST requestsIn order to mitigate JSON hijacking attacks that have the potential for information disclosure, by default, the JsonResult
class now responds only to HTTP POST
requests. AJAX GET calls to action methods that return a JsonResult
object should be changed to use POST instead. If necessary, you can override this behavior by setting the new JsonRequestBehavior
property of JsonResult
. For more information about the potential exploit, see the blog post JSON Hijacking on Phil Haack’s blog.
ModelBindingContext
are obsoleteA new settable ModelMetadata
property has been added to the ModelBindingContext
class. The new property encapsulates both the Model and the ModelType
properties. Although the Model
and ModelType
properties are obsolete, for backward compatibility the property getters still work; they delegate to the ModelMetadata
property to retrieve the value.
Changes in Preview 1
DefaultControllerFactory
class changes break custom controller factories that derive from itThis change affects custom controller factories that derive from DefaultControllerFactory
. The DefaultControllerFactory class was fixed by removing the RequestContext
property and instead passing the request context instance to the protected virtual methods GetControllerInstance
and GetControllerType
.
To update the custom controller factories to support ASP.NET MVC 2, change the method signature or signatures to match the new signatures, and use the request context parameter instead of the property.
The string “area” in Route values now has special meaning in ASP.NET MVC, in the same way that “controller” and “action” do. One implication is that if HTML helpers are supplied with a route-value dictionary containing “area”, the helpers will no longer append “area” in the query string.
If you are using the Areas feature, make sure to not use {area}
as part of your route URL.
Known Issues
The Add View dialog box throws a NullReferenceException when the Create strongly-typed view check box is checked, a View Content selection other than “Empty” is selected, and a View data class type name is specified for a type that does exist. When specifying a type name, either use the drop-down list to select the type name or type the fully-qualified type name. For types that do not exist, you must set View Content to “Empty”.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With