I have an endpoint I want to add to a Sitefinity installation. Essentially, I'm going to call an API and then return some json to an AJAX call from another page.
I figure I can create a blank template and a custom widget that does just that, since I have experience creating Sitefinity MVC widgets.
There is probably a less wrong way to do this though. Can I somehow (without much more work than creating a blank theme and a custom Widget in the CMS) create a one-off C# page that is publicly accessible?
I think you are talking about Classic MVC mode
1) You can define route in your Global.asax
protected void Application_Start(object sender, EventArgs e)
{
Bootstrapper.Initialized += Bootstrapper_Initialized;
}
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
{
if (e.CommandName == "Bootstrapped")
{
System.Web.Mvc.RouteCollectionExtensions.MapRoute(System.Web.Routing.RouteTable.Routes,
"Classic",
"customprefix/{controller}/{action}/{id}",
new { controller = "Feature", action = "Index", id = (string)null }
);
}
}
2) Create normal MVC controller with Views and Models
3) Access it by this URL http://localhost/customprefix/{controller}/{action}/{id}