Welcome to Dot Net Stories
This site is powered by a blog engine based on ASP.NET Core, HTML, Boostrap and jQuery
2019-07-15 12:21 by
When you are a bit into SQL, logging and statistics, you may want to extract some statistics from your logs. While a group by easily outputs a list of stats per date, when looking at a single indicator, you may be more confortable to see stats grouped per week to isolate seasonality of the week. This articles shows how to output such a table from a log with SQL Server.
2019-06-28 15:22 by
Generate a HTML string from cshtml razor view using ASP.NET Core that can be used in the c# controller code
2019-06-28 14:09 by
In several occasions, I needed a way to output the result of cshtml views as a string. Some day, I wanted a partial view that I could embed in a JSON response, another time it was to build an email template. For this, we need a feature that is mostly implemented with the Razor engine, but that is not publicly available (yet). In this article, you will discover how to build an efficient ViewToString renderer and get directly access to the HTML generated by a cshtml view.
2019-06-17 01:55 by
Have you ever dreamed of embedding everything required for a specific feature in a dedicated library? This article will teach you how to embed automatically your static files in an ASP.NET Core library. We have seen how to manually include static files in a razor library, this post will go even further and provide a way to do this automatically. Here you will find how to discover libraries that embed static files and include them automatically to serve them with the static file middleware.
2019-06-10 23:55 by
Not well known practice and not well documented but quite powerful: it is possible to override the base class of the views and pages in order to share a same logic or just to simplify some calls within views.
2019-06-10 12:25 by
This article explains a way to enable CORS requests for a single endpoint in ASP.NET Core, without using the official middleware. It has been made to add flexibility to the way CORS is handled.
2019-06-07 11:53 by
This article explains how to preload some assemblies for a .Net project and provides all the code required to replicate the behavior.
2019-06-06 16:26 by
2019-06-03 10:52 by
Since the ASP.NET Core 2.1 release, it became finally easy to implement independent web libraries embedding everything it needs to set up a feature.This post is the first of a serie, that intends to explain how to set an ASP.NET Core razor MVC library to be used as an independent plugin.Such a lib is autonomous, can be packaged in a NuGet and activated just by refencing this project.
2019-05-30 13:16 by
Few tools from the ASP.NET Core framework may be quite useful, but you should use the proper way to access them. This way is not always obvious, and knowing about it makes all the difference.This post explains how to allow injection of HttpContext and ActionContext in another injected class.