Umbraco AJAX not working

I have an MVC application where I installed the numbraco 6.1.6 nuget package. Now I'm trying to call a controller from a view using the jQuery AJAX function. The controller is placed in the MVC controller folder and inherited using the UmbracoApiController. I tried to execute the Umbraco API API , but every time my request sends it, it redirects to page 404. I tried the same thing with umbraco 7.1.4, downloaded from here , and it works fine for me. Can anyone suggest a solution for this.

The request URL that I used is: / Umbraco / Api / [controller_name] / [username] , I also tried / Umbraco / [YourAreaName] / [YourControllerName], but this also does not work for me.

+2
source share
1 answer

Check out different things:

  • reload the site (tap the web.config file)
  • Did you create the code? If you put it in app_code, it will be automatically loaded, otherwise you need the DLL to be in the bin directory.
  • What will the log files in / App _Data / Logs say?
    You can embed your own magazines by calling LogHelper.Info<myclass>("some message")
  • Are you really sure you haven’t missed something from the documentation?
    • Are you sure your controller inherits from UmbracoApiController
    • [MemberAuthorize(AllowAll = true)] api ?
  • URL-. , , . - "". , URL.

, . , Razor. , - .

var requestHandler = HttpContext.Current.Request.RequestContext;
var urlHelper = new UrlHelper(requestHandler);
var actionlink = Umbraco.Web.UrlHelperExtensions.GetUmbracoApiService<MyApiController>(urlHelper, "MyMethodName");
+2

All Articles