Copied to clipboard

Flag this post as spam?

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


  • Saba Tandashvili 29 posts 181 karma points
    Nov 22, 2018 @ 07:02
    Saba Tandashvili
    0

    Umbraco surface controller routing problem

    Hi, I am making umbraco surface controller for ajax request. First I made Controllers folder under project. Then I added new controller class. Just followed documentation from link below. https://our.umbraco.com/documentation/reference/routing/surface-controllers

    Here is my code in controller.

    public class TestController : Umbraco.Web.Mvc.SurfaceController
    {
        public ActionResult Index()
        {
            var listOfNames = new List<string>() { "Warren", "Bob", "Tom" };
            return Json(listOfNames, JsonRequestBehavior.AllowGet);
        }
    }
    

    So i hoped to route controller as described in documentation:

    http://localhost:52664/umbraco/surface/test/index
    

    But i get HTTP Error 404.0 - Not Found. I tried everything I could but no result. Umbraco version is 7.12.4. Anyone had same problem before ?

  • louisjrdev 107 posts 344 karma points c-trib
    Nov 22, 2018 @ 08:59
    louisjrdev
    0

    Hi Saba,

    Have you ensured you have built the solution?

    I dropped this code into a brand new umbraco installation and it worked fine for me

    If that doesnt work, something else in your project must be interfering with the routing

  • Saba Tandashvili 29 posts 181 karma points
    Nov 22, 2018 @ 09:15
    Saba Tandashvili
    100

    Yes i have built the solution. Seems like i have to make a new installation. But i am sure everything is perfect with routing :( Something else happens here.

    Edit: after installing brand new umbraco + 1 hours of code moving and bug fixing finally i got working Custom SurfaceController.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies