Hello, i am getting the url 404 not found when loading in a macro.
But then i get in the console a
No HTTP resource was found that matches the request URI 'https://localhost:44351/umbraco/api/prisinformation/produktlista?typ=1&version=0'.No action was found on the controller 'PrisInformation' that matches the name 'produktlista'.
and a
No HTTP resource was found that matches the request URI 'https://localhost:44351/umbraco/api/prisinformation/produktlista?typ=0'.No action was found on the controller 'PrisInformation' that matches the name 'produktlista'.
the code i try to call is this one.
no mather how much i try i get this error when calling the macro.
public class PrisInformationController : UmbracoApiController
{
private ILoginService _userService;
private MembershipHelper _membershipHelper;
public PrisInformationController(MembershipHelper membershipHelper, ILoginService userService)
{
_userService = userService;
_membershipHelper = membershipHelper;
}
public void Authorize()
{
if (!_membershipHelper.IsLoggedIn())
{
if (_userService.AddAndOrLoginMember())
{
return;
}
}
throw new HttpException(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Page not found").ToString());
}
[HttpGet, HttpPost]
[Route("produktlista/{typ}")]
public HttpResponseMessage Produktlista(int typ = 0, int version = 0)
{
Authorize();
string result = string.Empty;
string apiUrl = ConfigurationManager.AppSettings["ApiUrl"];
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl + "/databoken/get/produktlista/" + typ + "/" + version);
request.Method = WebRequestMethods.Http.Get;
request.Accept = "application/json";
var response = request.GetResponse();
string s = string.Empty;
using (var sr = new StreamReader(response.GetResponseStream()))
{
result = sr.ReadToEnd();
}
}
Backoffice macro returns 404
Hello, i am getting the url 404 not found when loading in a macro.
But then i get in the console a
No HTTP resource was found that matches the request URI 'https://localhost:44351/umbraco/api/prisinformation/produktlista?typ=1&version=0'.No action was found on the controller 'PrisInformation' that matches the name 'produktlista'.
and a No HTTP resource was found that matches the request URI 'https://localhost:44351/umbraco/api/prisinformation/produktlista?typ=0'.No action was found on the controller 'PrisInformation' that matches the name 'produktlista'.
the code i try to call is this one. no mather how much i try i get this error when calling the macro.
oh and the view i use is this.
@using Umbraco.Web.Models @inherits Umbraco.Web.Macros.PartialViewMacroPage @{ @var year = Convert.ToInt32(Model.MacroParameters["year"]); var month = Convert.ToInt32(Model.MacroParameters["month"]);@ var produktId = !string.IsNullOrEmpty(Model.MacroParameters["produktId"].ToString()) ? Convert.ToInt32(Model.MacroParameters["produktId"]) : 0; var produktIdEgen = !string.IsNullOrEmpty(Model.MacroParameters["produktIdEgen"].ToString()) ? Convert.ToInt32(Model.MacroParameters["produktIdEgen"]) : 0; int decimals = !string.IsNullOrEmpty(Model.MacroParameters["decimals"].ToString()) ? Convert.ToInt32(Model.MacroParameters["decimals"]) : 0; int pristyp = !string.IsNullOrEmpty(Model.MacroParameters["pristyp"].ToString()) ? Convert.ToInt32(Model.MacroParameters["pristyp"]) : 0; int sjvData = 0;//!string.IsNullOrEmpty(Model.MacroParameters["sjvData"].ToString()) ? Convert.ToInt32(Model.MacroParameters["sjvData"]) : 0;
int tableIndex = 2; if (produktIdEgen > 0) { produktId = produktIdEgen; tableIndex = 3; sjvData = 1; } }
@Html.Action("GetDataFromAgr", "AgrApi", new { tableIndex = tableIndex, ar = DateTime.Now.Year, manad = 0, produktId = produktId, decimals = decimals, pristyp = pristyp, sjvData = sjvData })
is working on a reply...