Copied to clipboard

Flag this post as spam?

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


  • Ross Ekberg 103 posts 311 karma points
    20 days ago
    Ross Ekberg
    0

    Backoffice Routing Not Found

    I have a backoffice property editor that is a dropdown list that is meant to populate from a database. Here is the plugin controller, saved in the App_Code folder:

    namespace My.Controllers
    {
        public class Subscription
        {
            public int SubID { get; set; }
            public string Title { get; set; }
        }
    
        [Umbraco.Web.Mvc.PluginController("My")]
        public class SubscriptionPickerAPIController : UmbracoAuthorizedJsonController
        {
    
            public string GetAll()
            {
                List<Subscription> subs = new List<Subscription>();
                string conn = System.Configuration.ConfigurationManager.ConnectionStrings["WebSubscriptionsEntities"].ToString();
    
    
                conn = conn.Substring(conn.IndexOf("\"") + 1);
                conn = conn.Substring(0, conn.IndexOf("\""));
    
                using (SqlConnection connection = new SqlConnection(conn))
                {
                    connection.Open();
    
                    SqlCommand command = new SqlCommand("Select * from Subscriptions order by Title", connection);
    
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while(reader.Read())
                        {
                            Subscription thissub = new Subscription();
                            thissub.SubID = (int)reader[0];
                            thissub.Title = (string)reader[1];
                            subs.Add(thissub);
                        }
                    }
                }
    
                string output = new JavaScriptSerializer().Serialize(subs);
                return output;      
            }
        }
    }
    

    I have the following AngularJS resource calling it, saved in the App_Plugins folder:

    angular.module('umbraco.resources').factory('SubscriptionPickerResource',
        function ($q, $http) {            
            return {                
                getAll: function () {                
                    return $http.get("backoffice/My/SubscriptionPickerApi/GetAll/");
                }
            };
        }
    ); 
    

    My site runs over HTTPS. I have a redirect setup in IIS to direct all traffic to HTTPS. the web.config setting 'UmbracoUseSSL' is set to true.

    I keep getting a 404 error. I have tried a bunch of different URL iterations, all come back 404. When I examine the request, I see the URL is 'https://mydomain.com/umbraco/backoffice/My/SubscriptionPickerApi/GetAll/'

    What am I doing wrong?

  • Ross Ekberg 103 posts 311 karma points
    1 week ago
    Ross Ekberg
    0

    Anyone?

  • Ross Ekberg 103 posts 311 karma points
    7 days ago
    Ross Ekberg
    0

    Bueller?

Please Sign in or register to post replies

Write your reply to:

Draft