Copied to clipboard

Flag this post as spam?

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


  • Ivan 165 posts 543 karma points
    Nov 23, 2016 @ 12:27
    Ivan
    0

    OWIN on Umbraco 7.2.6 - UmbracoContext.Current is always null

    Hi all,

    I have managed to start OWIN with the following configuration.

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();
    
            config.MapHttpAttributeRoutes();
    
            app.UseWebApi(config);
    
            config.EnsureInitialized();
        }
    }
    

    And the controller:

    [RoutePrefix("menu")]
    public class MenuController : UmbracoApiController
    {
    
        [HttpGet]
        [Route("get")]
        public MenuResponse GetMenu()
        {
            var uHelper = new UmbracoHelper(UmbracoContext.Current); // Exception: Value cannot be null
        }
    }
    

    BUT! The UmbracoContext.Current is always null.

    We are using Umbraco V7.2.6 and it's not possible to use Umbraco.Web.UmbracoDefaultOwinStartup.

    Is there a chance to make UmbracoContext work on v7.2.6?

  • mzaibi 4 posts 72 karma points
    Nov 30, 2017 @ 12:57
    mzaibi
    0

    I have the same problem and, can anyone help me resolve this issue

Please Sign in or register to post replies

Write your reply to:

Draft