Copied to clipboard

Flag this post as spam?

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


  • Mattias 3 posts 73 karma points
    Jan 20, 2016 @ 09:06
    Mattias
    0

    No form picker, just "clear"

    Hi,

    I recently upgraded a site to Umbraco v.7.3.0 and Contour stopped working. I received the infamous 500-error, /umbraco/Contour/FormsApi/GetAll.

    We then upgraded Contour to version 3.0.28 and it all started working, the form picker showed up and I was able to pick forms and publish to pages. This was at the end of last week.

    I then let our clients in to the site for testing and now the 500-error is back and no form picker is showing.

    Is there anyone out there who has an idea of what could have happened?

    Kind regards, Mattias

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 20, 2016 @ 09:17
    Dennis Aaen
    0

    Hi Mattias and welcome to our :-)

    Status code 500 is an internal server error so hopefully you'll find more details in the logs.

    You can find the logs here Event Viewer > Windows Logs > Application.

    Hope you can get some more info why you are getting the 500 error from these log files.

    /Dennis

  • Mattias 3 posts 73 karma points
    Jan 20, 2016 @ 09:38
    Mattias
    0

    Thanks :)

    Im not getting anything from the Event viewer..

    This is the error message I got from Chrome dev toolbar:

    { "Message":"An error has occurred.", "ExceptionMessage":"Object reference not set to an instance of an object.", "ExceptionType":"System.NullReferenceException","StackTrace":" at Umbraco.Forms.UI.Security.HasAccessToForm(Guid form)\r\n at Umbraco.Forms.Core.Providers.V7.PropertyEditors.FormsApiController.GetAll()\r\n at lambda_method(Closure , Object , Object[] )\r\n
    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
    at System.Runtime.CompilerServices.TaskAwaiter
    1.GetResult()\r\n
    at System.Web.Http.Controllers.ApiControllerActionInvoker.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 20, 2016 @ 10:23
    Dennis Aaen
    0

    Hi Mattias,

    Okay, unfortunately you have hit into this issue http://issues.umbraco.org/issue/CON-863

    This will be fixed in the next release of Umbraco Contour.

    /Dennis

  • Mattias 3 posts 73 karma points
    Jan 20, 2016 @ 11:03
    Mattias
    0

    Hi Dennis,

    I see, do you have any idea of when this will be released?

    What I don¨t understand is that this problem seemed to be fixed when we upgraded to version 3.0.28 and then a couple of days later the error is back.

    What could possibly chagned from one day to another?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 20, 2016 @ 12:53
    Dennis Aaen
    0

    Hi Mattias,

    Unfortunetly I can´t give you an exact date, when the next version of Contour will be released I am sorry.

    The fixed for this has been created, but not release yet. Yes sounds very odd that couple of days later the error is back.

    Just for curiosity is there a specific reason why you are using Contour instead of Umbraco Forms, when you are running Umbraco v.7.3.0

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 21, 2016 @ 09:09
    Dennis Aaen
    100

    Hi Mattias,

    If you can send me an email on dennis (at) umbraco dot com, then I can sent you a patch that you could try.

    /Dennis

  • Christian Palm 278 posts 273 karma points
    Feb 19, 2016 @ 14:09
    Christian Palm
    0

    I have fixed this problem with a work-around.

    I created have created a new FormsApiController and removed the Security stuff :-)

    Changed the URL in /App_Plugins/Contour/formpicker.controller to backoffice/api/formsapi/getall in my case.

    The api controller is still only allowed to umbraco backend users! But it will not check for read access. Which is not a problem for our editors.

    Here is the source for FormsApiController

    using System.Collections.Generic;
    using Umbraco.Forms.Core;
    using Umbraco.Forms.Data.Storage;
    using Umbraco.Web.WebApi;
    
    namespace Web.Controllers.BackendControllers
    {
        public class FormsApiController : UmbracoAuthorizedApiController
        {
            public IEnumerable<Umbraco.Forms.Core.Providers.V7.Models.Form> GetAll()
            {
                List<Umbraco.Forms.Core.Providers.V7.Models.Form> list = new List<Umbraco.Forms.Core.Providers.V7.Models.Form>();
                FormStorage formStorage = new FormStorage();
                foreach (Form f in formStorage.GetAllForms(false))
                {
                    // Bypass the Security
                    //if (Security.HasAccessToForm(f.Id))
                    //{
                    list.Add(new Umbraco.Forms.Core.Providers.V7.Models.Form()
                        {
                            Id = f.Id,
                            Name = f.Name,
                            Fields = this.GetFormFields(f)
                        });
                    //}
                }
                formStorage.Dispose();
                return list;
            }
    
            private string GetFormFields(Form f)
            {
                string[] strArray = new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" };
                string str1 = string.Empty;
                if (f.AllFields.Count <= 4)
                {
                    int num = 1;
                    foreach (Field field in f.AllFields)
                    {
                        str1 += field.Caption;
                        if (num == f.AllFields.Count - 1)
                            str1 += " and ";
                        else if (num < f.AllFields.Count)
                            str1 += " ,";
                        ++num;
                    }
                }
                else
                {
                    for (int index = 0; index < 3; ++index)
                        str1 = str1 + f.AllFields[index].Caption + " ,";
                    string str2 = str1 + f.AllFields[3].Caption + " and ";
                    if (f.AllFields.Count > 14)
                    {
                        str1 = str2 + " and a lot more";
                    }
                    else
                    {
                        str1 = str2 + strArray[f.AllFields.Count - 5] + " additional field";
                        if (f.AllFields.Count != 1)
                            str1 += "s";
                    }
                }
                return str1;
            }
        }
    }
    
  • Łukasz Bańcarz 2 posts 22 karma points
    Mar 10, 2016 @ 12:47
    Łukasz Bańcarz
    0

    @Christian Palm No need to "Bypass the Security". You just need to specify namespace of 'Security' class. (Since Umbraco 7.3 - 'Security' is a new property to 'UmbracoApiControllerBase' class of type 'Umbraco.Web.Security.WebSecurity')

    -- All you need to do is:

    Declare alias to Umbraco.Forms.UI

    using ui = Umbraco.Forms.UI;
    

    Use new namespace alias

    if (ui.Security.HasAccessToForm(f.Id))
    

    Note: You can't use directly 'Umbraco.Forms.UI.Security.HasAccessToForm(f.Id)' because 'Umbraco' in this scope reffers to property on 'Umbraco.Web.WebApi.UmbracoApiControllerBase' of type 'Umbraco.Web.UmbracoHelper'

Please Sign in or register to post replies

Write your reply to:

Draft