In this short post, find the code to disable Anti-forgery token validation globally in ASP.NET Core Razor pages. If you are new to Razor Pages, It’s a new feature of ASP.NET Core that makes coding page-focused scenarios easier and more productive. Razor pages use handler methods to deal with the incoming HTTP request (GET/POST/PUT/Delete). Read More
Tag: ASP.NET Core
Create a React app in 5 steps using dotnet cli
Earlier I posted about creating an Angular 5 app in 5 steps using dotnet cli based on the new release candidate version of Single-Page Application templates. These templates allow developers to create SPA application based on Angular, React, and React with Redux. At the time of writing this post, the final version is scheduled to release in Early 2018. This post shows how to create a React app in 5 steps using dotnet cli. Read More
Define a custom environment in ASP.NET Core
One of the cool features of ASP.NET Core is, Hosting Environment Management. It makes life easy for the developers, while dealing with multiple environments. Previously, the developers have to build the application differently for each environment (Staging, UAT, Production) due to dependency on config file sections and the preprocessor directive applicable at compile time. It’s a time-consuming and painful process. ASP.NET Core takes a different approach and offers a new way to save developers from all this hassle. Read More
Tools for bundling and minification in ASP.NET Core
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
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
How to create an Angular 4 app with Visual Studio 2017
Configuring and creating angular apps with Visual Studio is not straightforward as it requires some manual configuration settings and some addition of .config
files. It would be nice to have a ready-made template which would take this pain away and save the time. With Visual Studio 2017, a template is available for creating and running sample Angular application. The template is good enough to get you started with Angular. This post talks about how to create an Angular 4 App with Visual Studio 2017 and how to extend it with a simple example.
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