Copied to clipboard

Flag this post as spam?

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


  • Jan Vanuytrecht 32 posts 80 karma points
    Nov 04, 2015 @ 10:22
    Jan Vanuytrecht
    0

    RecordStorage InsertRecord method requires HttpContext.Current.Request, which is not always available

    Hi,

    We have code to migrate our "old" contour records to Umbraco forms.

    Something like :

    Code
     foreach (var umbracoFormRecord in umbracoFormRecords)
    {                        
             // create the record
             recordStorage.InsertRecord(umbracoFormRecord, umbracoForm);                                
    }
    

    We can't do this, because the current line in the Umbraco.Forms.Data.Storage.RecordFieldValueStorage class uses the Licensing.IsLocalBrowserRequest() check. The result is not used anywhere though !?

    Umbraco.Forms.Data.Storage.RecordFieldValueStorage:

    bool flag = Licensing.IsLocalBrowserRequest();
    

    which translates into:

    Umbraco.Forms.Core.Licensing:

    public static bool IsLocalBrowserRequest()
    {
        return HttpContext.Current != null && HttpContext.Current.Request.IsLocal;
    }
    

    And there's the problem: HttpContext.Current.Request ... Which means we can't use this in the ApplicationStarting event.

    Much worse, you can't do this in any (Web)ApiController!

    I've logged an issue here : http://issues.umbraco.org/issue/CON-846

Please Sign in or register to post replies

Write your reply to:

Draft