List of Posts
This is the complete list of categories of posts written under the category C# . They have been ordered by the publish date, with the most recent first.
- (C# ASP.NET Core Ajax) How to POST data with AJAX Independently of (i.e., without) a Form and hence solve the HTTP Bad Request Error 400Published: 25-Mar-2021Anti-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?
- Published: 23-Mar-2021Following are my top 6 interview questions on the "init" accessor introduced recently in C# 9. The answers have all been fully explained through code examples. All the examples have been kept as short as possible.
- Published: 22-Mar-2021Simplest 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.
- Published: 12-Mar-2021THE CRUX: record types are meant for storing read-only, init-once data. They serve the purpose of ValueTypes, but in reality they are reference types; they have best of both the worlds. They, being reference types, can be efficiently passed as function arguments(like class objects), and yet they carry data like structs [though read-only] but the data doesn't get copied during function calls - this promotes efficiency. They are 2-in-1: they are RefTypes but they perform the task of ValueTypes (though read-only, init-once). So with C# 9.0 we have a triad - class, struct and record. Two different instances of records are equal if they contain the same data (like structs, and un-like the classes!) The "positional record" syntax makes it easier to create their objects, and the newly introduced "with" expressions make it even easier to create their exact copies, possibly with just-in-time alterations to some of their properties.
- Published: 11-Mar-2021This 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.
- Published: 03-Mar-2021How to POST an ASP.NET Core Razor FORM 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!
- Published: 27-Sep-2020Some, 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?
- (C# ASP.NET Core)How to restrict access ONLY to requests from a specific list of domains and ports onlyPublished: 25-Sep-2020Write 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"?
- Published: 23-Sep-2020This 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.
- Published: 18-Sep-2020Use 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.
- Published: 16-Sep-2020This 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.
- Published: 03-Sep-2020This 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.