Open Closed

How to route to the dashboard without landing Index page? #308


User avatar
0
alper created
Support Team Director

Project: MVC + Tiered. I want to skip the /Index page and route to Login page and after the successfull login, I wan to route to the Dashboard page.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    Change your Index.cshtml.cs to

    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Authentication;
    using Microsoft.AspNetCore.Mvc;
    
    namespace Mvc.Tiered1.Web.Pages
    {
        public class IndexModel : Tiered1PageModel
        {
            public async Task<IActionResult> OnGetAsync()
            {
                return RedirectToPage(CurrentUser.TenantId.HasValue ? "/TenantDashboard" : "/HostDashboard");
            }
    
            public async Task OnPostLoginAsync()
            {
                await HttpContext.ChallengeAsync("oidc");
            }
        }
    }
    

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.