Copied to clipboard

Flag this post as spam?

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


  • Robert 21 posts 122 karma points
    Oct 04, 2016 @ 11:07
    Robert
    0

    Umbraco.Web.UmbracoContext.Current.PublishedContentRequest is null

    Hi, there; I am having a model that inhertis from:

    public class MyModel : RenderModel
    {
         public MyModel ()
            : base(Umbraco.Web.UmbracoContext.Current.PublishedContentRequest.PublishedContent)
        {
            ...
        }
    }
    
    In one of my MVC views I use ajax call to a server SurfaceController action method:
    
     public ActionResult IHaveSite()
        {
            MyModel mode = new MyModel (); //I am having Umbraco.Web.UmbracoContext.Current.PublishedContentRequest is null error
            //
           //other logic
           //
    
        }
    

    My view has:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage

    Can some help what I do wrong please?

    Cheers Robert

Please Sign in or register to post replies

Write your reply to:

Draft