Copied to clipboard

Flag this post as spam?

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


  • Evangelos Lolos 7 posts 98 karma points
    Feb 16, 2016 @ 15:42
    Evangelos Lolos
    0

    Render Partial from custom UmbracoAuthorizedController fails after upgrade to 7.4.0

    I have an existing backoffice controller inheriting from UmbracoAuthorizedController that is used to preview a grid editor's output within the grid, by rendering a partial view with a model of type UmbracoViewPage<dynamic>

    [IsBackOffice]
    public class GridController : UmbracoAuthorizedController
    {
        [HttpPost, ValidateInput(false)]
        public ActionResult Preview(string viewPath)
        {
            Request.InputStream.Seek(0, SeekOrigin.Begin);
            var json = new StreamReader(Request.InputStream).ReadToEnd();
            dynamic model = JsonConvert.DeserializeObject(json);
    
            return PartialView(viewPath, model);
        }
    }
    

    This has been working quite well, until the update to 7.4.0. The error I'm getting is:

    [NullReferenceException: Object reference not set to an instance of an object.]     
    Umbraco.Web.Mvc.UmbracoViewPage`1.SetViewData(ViewDataDictionary viewData)
    

    Any ideas as to how I can fix this? Is there a way to change the internal state of the UmbracoContext so that my code no longer fails?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 17, 2016 @ 17:05
Please Sign in or register to post replies

Write your reply to:

Draft