Skip to content

erossini/AdminLTEWithASPNETCore

 
 

Repository files navigation

Integrating AdminLTE with .NET5 or ASP.NET Core 3.1

We will learn how integrating AdminLTE with ASP.NET Core 3.1 MVC or really any other Bootstrap based UI Frameworks completely from scratch. We will also go through about integrating Identity Server to our MVC Applicaiton. Also, you will gain quite a lot of practical knowledge on Views, Layouts, Partial Views, Conditional Rendering, Navigation Indicator and much more.

For more details about this project, you can read my post titled Integrating AdminLTE with ASP.NET Core from my blog PureSourceCode

I updated the project to .NET5. You can use the same project with .NET Core 3.1 if you downgrade the project from .NET5 to .NET Core 3.1 and the NuGet packages.

In this project template you have already:

If you have any question, please use the PureSourceCode Forum.

Screenshots

The result of the main application is this one:

Integrating AdminLTE with ASP.NET Core 3.1

Login

Login in ASP.NET 5 with AdminLTE

How do I organize the solution?

The project is divided into the following layers:

  • Tasks
  • Domain
  • Infrastructure
  • Presentation
  • Specs/Tests

Task

Previous known as “Application Services,” the Tasks Layer serves to tie together any non-business logic from a variety of third-party services or persistence technologies.

Presentation

The Presentation Layer contains the familiar MVC project with views, viewmodels and controllers, along with application setup tasks.

Infrastructure

The Infrastructure Layer setups up third party data sources. You can extend the repository implementation with additional methods to perform specific queries.

Domain

The Domain Layer is where business entities and other business logic resides. The domain layer should be persistence ignorant, with any persistence existing in the Tasks Layer or in the Presentation Layer (for populating viewModels).

New View Components

There are new ASP.NET Core ViewComponents to enrich the UI:

  • Boxes
    • simple
    • progressbox
    • showbox
  • Charts with Chart.js
    • Bar
    • Line
    • Pie
  • Card (simple)

AdminLTE integration with ASP.NET Core 5 - Creation of new view components

Integration with IdentityServer4

In the project you find an integration with IdentityServer4. To enable the authentication with IdentityServer, you have to change the appsettings.json under Authentication and modify UseIdentityServer to true.

"Authentication": {
    "UseIdentityServer": true,
    "IdentityServer": {
        "IdentityServerUrl": "https://youridentityserver.com",
        "ClientId": "",
        "ClientSecret": ""
    }
}

Although the implementation in the project is correct, you will face an issue: after the login with IdentityServer, the application calls again and again IdentityServer for authentication. Basically, there is a loop between the application and IdentityServer. I discovered that this issue is coming from Microsoft Identity.

If you want the authentication with IdentityServer, you have to remove all packages related to Microsoft Identity and under the Area folder remove the Pages folder and IdentityHostingStartup.cs. Clean the solution, the cookies in your browser and then everything will work.

I left the branch named Only IdentityServer where I removed all the Microsoft.Identity Nuget packages and clean the solution for that.

More info

If you want an implementation of a particular view or feature, please use our Forum and explain what you like to have.

More features are coming...

About

How to integrate AdminLTE in an ASP.NET Core MVC and .NET5 project

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors