Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • slowseer 5 posts 75 karma points
    Feb 15, 2016 @ 01:18
    slowseer
    0

    7.4 surface controller models broke

    I just upgraded to 7.4 today from 7.2 (using nuget) and I'm getting the following error (code worked fine in 7.2):

    Cannot bind source content type Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent to model type Models.Auth.LoginModel
    
    Umbraco.Web.Mvc.RenderModelBinder.BindModel(Object source, Type modelType, CultureInfo culture) +551
    

    Heres my Model:

    public class LoginModel : Umbraco.Core.Models.PublishedContent.PublishedContentModel
    {
        public LoginModel() : this(new UmbracoHelper(UmbracoContext.Current).TypedContent(UmbracoContext.Current.PageId)) { }
        public LoginModel(IPublishedContent content) : base(content) { }
    
        [Required]
        [MaxLength(100)]
        public string Email { get; set; }
    
        [Required]
        [MaxLength(100)]
        public string Password { get; set; }
    
        [MaxLength(500)]
        public string RedirectUrl { get; set; }
    }
    

    and Its a regular post on my auth surface controller:

        [HttpPost]
        public ActionResult HandleLogin(Models.Auth.LoginModel loginModel)
    

    Any advice? Does this method for building models still work in 7.4, or should I be trying out the new Models Builder?

    Noticed there is an updated DLL in another thread, I'll give that a try too.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 16, 2016 @ 11:41
    Jeroen Breuer
    1

    Hello,

    The model binder in Umbraco had a few updates in Umbraco 7.4. Maybe it's related to that: http://issues.umbraco.org/issue/U4-7754#comment=67-25489

    Jeroen

  • slowseer 5 posts 75 karma points
    Feb 26, 2016 @ 01:52
    slowseer
    0

    I just noticed that this is broken when posting to normal RenderMvcController's too. WTF happened in 7.4 to break this? :P

    7.4.1 didnt fix it at least. Pretty frustrating. Cant see anything in the patch notes or breaking changes about it.

Please Sign in or register to post replies

Write your reply to:

Draft