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/'
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:
I have the following AngularJS resource calling it, saved in the App_Plugins folder:
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?
Anyone?
Bueller?
is working on a reply...