Reputation: 1
I have problem with routing in kentico admin app. When I open home page, layout is visible, but there is no content. I need to go to the /home/index for the content to bi visible.
When I am running site locally, I am able to see content on my /home or /. I assumed that I am missing something in configuration of routing in my admin app.
Here is the part of a startup.cs
public void Configure(IApplicationBuilder app)
{
if (Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStatusCodePagesWithReExecute("/error/{0}");
app.UseRewriter(new RewriteOptions()
.Add(new AdminRedirect(Configuration)));
app.UseStaticFiles();
app.UseKentico();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.Kentico().MapRoutes();
endpoints.MapControllerRoute(
name: "error",
pattern: "error/{code}",
defaults: new { controller = "HttpErrors", action = "Error" }
);
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
And this is my HomeController.cs
using Microsoft.AspNetCore.Mvc;
using LearningKitCore.Models.SupportCenter;
using LearningKitCore.Manager;
using System.Collections.Generic;
namespace LearningKitCore.Controllers
{
public class HomeController : Controller
{
private readonly HomeManager _homeManager;
private Dictionary<string, string> GetTopMenu()
{
return new Dictionary<string, string>()
{
{ "Demo Center", "Demo-Center" },
{ "What's New", "What-s-New" },
{ "Video Tutorials", "Video-Tutorials" },
{ "Shortcuts", "Shortcuts" },
{ "Downloads", "Downloads" },
{ "Trust", "Trust" }
};
}
/// <summary>
/// Initializes a new instance of the HomeController class.
/// </summary>
/// <param name="homeManager">The HomeManager object used to retrieve home data.</param>
public HomeController(HomeManager homeManager)
{
_homeManager = homeManager;
}
/// <summary>
/// Retrieves home data and renders the Index view.
/// </summary>
/// <returns>The Index view with the retrieved data.</returns>
[Route("uatsupport_v13_live")]
[Route("uatsupport_v13_live/Home")]
[Route("")]
[Route("Home")]
[Route("Home/Index")]
[Route("Home/Index/{id?}")]
public IActionResult Index()
{
// Retrieve data using HomeManager
var (pageLinks, articleText) = _homeManager.GetHomeData();
// Create an instance of MyViewModel and set its properties
var newModel = new MyViewModel
{
PageLinks = pageLinks,
DictHomeArticleText = articleText,
DictTopMenu = GetTopMenu()
};
return View(newModel);
}
}
}
So I am trying to render the content on the path: /home or / on my admin app
Upvotes: 0
Views: 21