Bundling and minification improves the speed and rendering performance of any web application. Bundling combines multiple JavaScript or CSS files into a single file where Minification reduces the size of the JavaScript or CSS file by removing white space and commented code without altering functionality. This not only reduces the number of requests to the server, also reduces the size of data transfer from the server to the browser. Both the techniques when used together can help in improving the performance of your web app. Bundling and minification can be done at design time and also at runtime. This post talks about 6 tools for bundling and minification in ASP.NET Core. Read More
Tag: ASP.NET Core 2.0
Upgrade Angular 4 app to Angular 5 with Visual Studio 2017
Last month, Angular 5 was released with some code breaking changes. You can refer to this post for the list of changes. I was playing with Angular 5 and as part of this learning process; I thought of upgrading one of my previously created Angular 4 app to Angular 5. You can read my post about creating an Angular 4 application with Visual Studio 2017. This post talks about how to upgrade Angular 4 app to Angular 5 with Visual Studio 2017. The steps given in this post are applicable for Angular 4 apps created using Visual Studio 2017, but some of these steps will also apply to Angular 4 apps created using other ways. Read More
How to Implement single authorization policy in ASP.NET Core 2.0
Along with role-based and claim based authorization, ASP.NET Core also supports the policy-based authorization. A policy is nothing but a collection of requirements with different data parameters to evaluate the user Identity. Read more about the policy-based authorization here. This short post shows how to implement single authorization policy in ASP.NET Core 2.0 application. Once implemented, the policy becomes global and applicable to the whole application. Read More
Add Swagger to ASP.NET Core 2.0 Web API
Testing WEB APIs is a challenge, and it has a dependency on various third-party tools for proper and efficient testing. But swagger can make it easy. Swagger is an UI representation of your RESTful API. Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources having none of the implementation logic in place. It’s automatically generated from your Swagger specification, with the visual documentation, making it easy for back-end implementation and client-side consumption. Earlier, I posted about adding swagger with ASP.NET Core but it no longer works with ASP.NET Core 2.0 due to new changes with ASP.NET Core 2.0. In this post, we’ll see how to add Swagger to ASP.NET Core 2.0 Web API. Read More
Import and Export excel in ASP.NET Core 2.0 Razor Pages
Last year around this time I wrote about Import and Export xlsx in ASP.NET Core, using an unofficial version of EPPlus.Core as EPPlus didn’t have .NET core support. In fact, many such popular libraries lacked support for .NET Core as the framework was not mature enough then. When .NET Standards came, the situation improved a bit, but the release of .NET Standards 2.0 was a booster for .NET Core as that helped to port existing .NET Framework based libraries to use with .NET Core.
NPOI is another very popular package for reading/writing excel files, and it also has .NET core version as well. This post talks about how to import or export excel files (xls or xlsx) using NPOI package with ASP.NET Core 2.0 Razor pages. Read More
Uploading Multiple Files in ASP.NET Core Razor Pages
If you are a fan of ASP.NET Web forms and miss them, ASP.NET Core Razor Pages gives you the exact same feeling of ASP.NET Web forms. Razor Pages are a new feature of ASP.NET Core 2.0 that makes coding page-focused scenarios easier and more productive. Razor Pages are introduced with the intent of creating page focused scenarios where there is no real logic is involved. This short post talks about the solution for uploading multiple files in ASP.NET Core Razor Pages using jQuery and Ajax. Read More
How to Get Client IP Address in ASP.NET Core 2.0 Razor Pages
In this short post, find the code to get client IP address in ASP.NET Core 2.0 Razor pages. You need to inject IHttpContextAccessor
in razor page using @inject
. You can inject a service into a view using the @inject
directive. You can think of @inject
as adding a property to your view, and populating the property using DI. Read More