Global exception handling in asp.net core

Global exception handling is a way to handle unhandled exceptions in asp.net core. Add a middleware UseExceptionHandler to the pipeline that will catch exceptions, log them, reset the request path and re-execute the request. The request will not be re-executed if the response has already started. Add UseExceptionHandler code in Startup.Configure method as stated below. Continue Reading »

TempData is null in asp.net core

The TempData provider cookie isn’t essential. CheckConsentNeeded is used to get user permission to enable cookies. If user has denied cookies then TempData cookies will not be provided to browser. In Asp.Net Core 2.1 to enable TempData cookies disable the CheckConsentNeeded option in Startup.ConfigureServices method. Asp.Net Core 2.2 has provided a new feature to configure the Continue Reading »

Delete, Backspace, Tab and Arrow keys are not working in Firefox when applying validation.

To get this work in Firefox. Try it

How to encode URI components in javascript?

JavaScript provides an encodeURIComponent() function to encode uri components. This function encrypt the special characters provided in the url such as “space , / ? : @ & = + $ #“. Syntax encodeURIComponent(uri) Example Html Result How to encode URI components in javascript? URI: codesolution.org/calculate-time-between-two-dates/ Encoded URI: codesolution.org%2Fcalculate-time-between-two-dates%2F Try it

Calculate time between two dates

Using moment.js, We can calculate time between two dates in jquery. JavaScript Html Result Calculate time between two dates Start Date Time : Jul 29, 2017, 12:25:00 End Date Time : Aug 30, 2017, 22:30:00 Hours : 778.0833333333334 Minutes : 46685 Try it

Calculate days between two dates in jquery.

Using moment.js, We can calculate days between two dates in jquery. JavaScript Html Result Calculate days between two dates Start Date : Jul 29, 2017 End Date : Aug 30, 2017 Days : 32 Try it

Fizz Buzz game C#

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Update List from another list C#.

To update a list from another list, Here is the Syntax. Syntax Example 1. Create Student model 2. Create Student List as listStudents 3. Create Student Marks as listMarks 4. Now Update listStudents from listMarks

Convert a list of string to comma separated string C#.

Convert a list of string to Comma Separated String. String.join method is used to concatenate a list of string, Using a specified separator between each string. Syntax : String.Join(string Separator, String[] Values); Example :