List of Posts under ASP.NET Core

This is a list of of posts written under the category ASP.NET Core,

Categories | About |     |  

List of Posts

This is the complete list of categories of posts written under the category ASP.NET Core . They have been ordered by the publish date, with the most recent first.

  1. Published: 26-Aug-2021
    This tutorial continues from where we left the tutorial on INSERT query (see the link below for a recap). The code we discussed there has been extended to display the inserted data. In the first part of this tutorial we explain the minimal three basic things that must be done to display data on a razor page. Then we incorporate those additions into the index page and its backing class to show the whole idea in action.


  2. Published: 24-Aug-2021
    This article explains behind-the-scenes mechanism by which "Session" is implemented in ASP.NET Core. We also enumerate the four extension methods that ASP.NET Core provides for reading and writing session variables. After that we present a walkthrough where existence of a Session key is checked to conditionally show a login link, or to show her user-name along with a log-off link that clears the user-name from the Session cache.


  3. Published: 23-Aug-2021
    So this article starts by explaining the various aspects of a partial view from a practical, day-to-day perspective. We have totally removed those parts that are either redundant or too complicated to be of any use for a practical developer. Then we take a small 3-step walkthrough that shows how to create a partial view, and how to consume it in a razor page. We also explain how a conditional menu can be conveniently implemented using the ideas of partial views. Partial Views + Razor Components can add to the confusion of a developer, so we finally conclude with a comparison with razor components.


  4. Published: 18-Aug-2021
    Razor components are stand-alone, embeddable units that replace themselves with pure HTML, CSS and JS markup. They can accept parameters from the host page. We discuss below how they differ from partial pages, and we also discuss the structure of a component page, and also how to use the <component> tag to easily embed a component into a razor page.


  5. Published: 16-Aug-2021
    This is a comprehensive discussion on the need for "areas", and how to practically create "areas", and how, un-like classic MVC, routing occurs out-of-the-box when razor pages are used. We also discuss how tag helpers help us create proper anchor links to pages inside areas. In the end we present a practical login and authorization scheme for projects that use areas.


  6. Published: 15-Aug-2021
    _ViewImports.cshtml is shared by all the razor pages in its peer directory, and in the sub-directories below it. It is like an include file, and it is used to type a list of common directives that would otherwise have to be typed in each of the razor pages. A razor page takes into account the entire hierarchy of _ViewImports files above it.


  7. Published: 14-Aug-2021
    This is a walkthrough on how to obtain user consent for usage of cookies on an asp.net core website. This project uses the ITrackingConsentFeature interface to determine if the user has already given his consent, and also to obtain the correct cookie string as per the http format. The readymade functions of this interface make it extremely easy for a developer to obtain a user's consent.


  8. Published: 13-Aug-2021
    We start this walkthrough with a small introduction to the concept of a cookie, and then we explain the various ASP.NET Core snippets to (a) create a cookie, (b) read a cookie and (c) delete a cookie. And lastly, we create a fully functional application for creating and deleting cookies. You can run the application to see the whole concept in action! We strongly recommend that you watch the linked video for finer details.


  9. Published: 12-Aug-2021
    A form of only one input textbox is POSTed and the data is inserted into a sqlite database. This is a six step walkthrough that starts from creating a model, followed by a DAL based on the DbContext class. We also explain how an application is configured for dependency injection of the DbContext, and also, how the DbContext is extracted from the constructor of a PageModel class, and ultimately used to run a database query.


  10. Published: 08-Aug-2021
    Here is a to-the-point tutorial on how database connectivity works in ASP.NET Core. A 3-step roadmap is laid for running your first query to a database of your choice. The tutorial concludes with an example walkthrough on adding nuget packages for a sqlite database. The actual database connectivity is done in later tutorials.


  11. Published: 07-Aug-2021
    This is a walkthrough on how to make calls to an XML database via repository pattern and dependency injection. We also give a brief introduction to the repository pattern and dependency injection, and also explain the associated benefits.


  12. Published: 06-Aug-2021
    This is the simplest example of reading and updating a record. For simplicity, the record consists of just one property called Name. An input textbox is used to display the "Name" and the same textbox is used to post the updated value. Reading and writing is done with the built-in XMLSerializer class.


  13. Published: 05-Aug-2021
    Looking for the "protected" App_Data folder in ASP.NET Core? The news is that it doesn't have that status anymore. It is no longer a "Special" folder. However, a workaround exists, and I demonstrate it in this tutorial. This tutorial explains how to read the contents of a notepad file (located in a "protected" folder of any random name). The contents are read from within the application, and displayed. Later we verify that the same notepad file cannot be accessed from the browser. This concept can easily be extended to use XML as a database, a topic we shall explore in some future posts.


  14. Published: 15-Jul-2021
    This is a $10 step by step video course for learning ASP.NET Core. Learn from the comfort of your home. Each topic is explained in a beginner's language. See the table of contents below for the clear roadmap.


  15. Published: 25-Mar-2021
    Anti-forgery token is NOT available outside of <form> tags. This article, alongwith the appended video, explains how to use IAntiforgery service to solve this limitation, and POST data, especially as an AJAX request, when a full-fledged form is not possible?


  16. Published: 22-Mar-2021
    Simplest explanation of AJAX based Edit, Update, Cancel operations on a row of an HTML table. An ASP.NET Core POST handler receives the updated values that can be processed for an update to a database.


  17. Published: 20-Mar-2021
    Pure Javascipt and html5 based general solution for in-place or in-line editing of the tr, td records of an html table. This solution is suitable for ajax based updates of the rows of a table. We shall demonstrate the concept with just one input text, but this solution can easily be extended to include dropdowns, radio buttons and checkboxes:


  18. Published: 16-Mar-2021
    In brief: Just two additions are required to implement AJAX based authorization in your existing ASP.NET Core application - first is on the javascript side - where the response code should be tested, and second on the server side where User.IsInRole has to be tested. The concept is explained in the text that follows, and a working example is described in the appended youtube video!


  19. Published: 11-Mar-2021
    This project is about creating an Admin Panel that would be suitable for a reporting project or an EBook that shows a table of links on the left and the corresponding content on the right side. The content is obtained by an Ajax call to an ASP.NET Core application. Source code for all the three files has been given and explained below.


  20. Published: 09-Mar-2021
    In nutshell: The selection change event of the master dropdown is used to send the "id" of the selected item to the server, which sends back a collection of items for the slave dropdown. A javascript based Ajax GET request is used for this communication with the server.


  21. Published: 05-Mar-2021
    The following project has a textbox with a send button. The click event fires an AJAX GET request and sends a string parameter to an ASP.NET Core application, which responds by converting the parameter to its uppercase equivalent. The client side script has been written using pure javascript.


  22. Published: 03-Mar-2021
    How to POST an ASP.NET Core 5 Razor Page through an Ajax Request. We discuss a practical approach that is to-the-point and easy to understand. The given code is ready to copy-paste!


  23. Published: 27-Sep-2020
    Some, not all, routes need a daily downtime between 17 hrs to 18 hrs. So they have to be shut during that period so that no requests are processed. Any request has to be redirected to another page or a website, say, hoven.in. How should that be implemented?


  24. Published: 25-Sep-2020
    Write an ASP.NET Core application such that the route "/home/index/N", where N is any int number, executes only if the website is hosted on port 67291 of "hoven.in" or "www.hoven.in". It should return 404 even if it is hosted on any subdomain like "*.hoven.in:67291"?


  25. Published: 23-Sep-2020
    This is a summary of the concepts of routing and route templates in asp.net core. We have taken a practical exercise to develop the concepts in an interesting way.


  26. Published: 18-Sep-2020
    Use the concepts learnt till now, and without using razor, and without mvc framework, create a contact form that has a text box (cusName) and a date picker (meetOn), and that posts data to your asp.net core application. The application echoes this data back to the browser.


  27. Published: 16-Sep-2020
    This tutorial explains everything necessary to get you started with the middleware in ASPNET Core. We explain the built-in middleware components as well as the Use, Map and Run extension methods through practical code.


  28. Published: 03-Sep-2020
    This tutorial explains the Startup class in ASP.NET, along with the methods of this class. We also explain how a custom middleware can be attached by IStartupFilter.