The HTML meta tag provides metadata about the HTML document. Metadata aren’t displayed on the page but are machine parsable. Meta elements are typically used to specify the page description, keywords, author, last modified, and other metadata. The metadata can be used by browsers (how to display content or reload the page), search engines (keywords), or other web services. Meta tags play an important role in SEO. In Angular 4, there is a service named “Meta” that can be used to get and add meta tags. This service can help you to set relevant meta tags based on the active routes, which in turn impacts SEO of your website. This post talks about how to use this service and get/set HTML meta tags using Angular 4. Read More
Best Practices for Load Testing
Optimizing the performance of your website ensures that you get the most out of your online traffic by offering users the experience that they expect. Additionally, search engines reward websites that perform well with top rankings. You will, therefore, gain significant benefits from preparing your website for high traffic loads. Load balancing is the best way to start optimizing the performance of your website because it prepares your website for peak activity. When your website is ready to be stressed to its maximum limits, you can be sure that it will perform well on a daily basis. This post talks about some of the best practices for load testing. 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
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
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
Handle Ajax Requests in ASP.NET Core Razor Pages
Razor Pages are 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). These are similar to Action methods of ASP.NET MVC or WEB API. Razor Pages follow particular naming convention and that is also true for Handler methods. They also follow particular naming conventions and prefixed with “On”: and HTTP Verb like OnGet()
, OnPost()
etc. The handler methods also have asynchronous version: OnGetAsync()
, OnPostAsync()
etc. Calling these handler methods from jQuery Ajax is tricky. This post talks how to handle Ajax requests in ASP.NET Core Razor Pages. Read More