Category UI
Building and securing an ASP.NET Core API with a hosted Vue.js UI
This article shows how Vue.js can be used together with ASP.NET Core 3 in a single project. The Vue.js application is built using the Vue.js CLI and built to the wwwroot of the ASP.NET Core application. The ASP.NET Core application is used to implement the APIs consumed by the Vue.js UI. The application is secured […]
An alternative way to build and bundle Javascript, CSS in ASP.NET Core MVC and Razor Page projects
This article shows how Javascript packages, files, CSS files could be built and bundled in an ASP.NET Core MVC or Razor Page application. The Javascript packages are loaded using npm in which most Javascript projects are deployed. No CDNs are used, only local files so that all external URLs, non self URL links can be […]
Securing browser based Javascript, Typescript applications
This article should help you in choosing the right security for your browser based Javascript or Typescript applications. You should aim to secure the application as best as possible. The following diagram should help you in making your decision. Also for any of these flows, you should always use HTTPS. Appendix SPA: Single page application […]
Securing a Vue.js app using OpenID Connect Code Flow with PKCE and IdentityServer4
This article shows how to setup a Vue.js SPA application to authenticate and authorize using OpenID Connect Code flow with PKCE. This is good solution when implementing SPA apps requesting data from APIs on separate domains. The oidc-client-js npm package is used to implement the client side authentication logic and validation logic. IdentityServer4 and ASP.NET […]
ASP.NET Core MVC Ajax Form requests using jquery-unobtrusive
This article shows how to send Ajax requests in an ASP.NET Core MVC application using jquery-unobtrusive. This can be tricky to setup, for example when using a list of data items with forms using the onchange Javascript event, or the oninput event. Code: https://github.com/damienbod/AspNetCoreBootstrap4Validation History 2020-08-31 Updated to use latest packages. Setting up the Project […]
Updating part of an ASP.NET Core MVC View which uses Forms
This article shows how to update part of an ASP.NET Core MVC view which uses forms. Sometimes, within a form, some values depend on other ones, and cannot be updated on the client side. Changes in the form input values sends a partial view update which updates the rest of the dependent values, but not […]
Updating ASP.NET Core Identity to use Bootstrap 4
This article shows how to update the default Identity Pages template to use Bootstrap 4. You need to scaffold the views into the project, and change the layouts and the views to use the new Bootstrap 4 classes and javascript. The base project is built using Webpack and npm. Bootstrap 4 is loaded from npm, […]
ASP.NET Core MVC Form Requests and the Browser Back button
This article shows how an ASP.NET Core MVC application can request data using a HTML form so that the browser back button will work. When using a HTTP POST to request data from a server, the back button does not work, because it tries to re-submit the form data. This can be solved by using […]
Dynamic CSS in an ASP.NET Core MVC View Component
This post shows how a view with dynamic css styles could be implemented using an MVC view component in ASP.NET Core. The values are changed using a HTML form with ASP.NET Core tag helpers, and passed into the view component which displays the view using css styling. The styles are set at runtime. Code: https://github.com/damienbod/AspNetCoreMvcDynamicViews […]
Securing the CDN links in the ASP.NET Core 2.1 templates
This article uses the the ASP.NET Core 2.1 MVC template and shows how to secure the CDN links using the integrity parameter. A new ASP.NET Core MVC application was created using the 2.1 template in Visual Studio. This template uses HTTPS per default and has added some of the required HTTPS headers like HSTS which […]