If we have to format the Nullable Date in C#, We can do like this
DateTime? date = new DateTime(2021, 05, 10, 22, 45, 12, 004);
//Will through exception
// string date_str = date.ToString("dd/MM/yyyy");
string date_str= (date != null ? date.Value.ToString("dd/MM/yyyy") : "n/a");
I m web developer so without browser I can not do any task. Browser is one of my cool and frequent use tool. I always open the browser using the shortcut like this
Go to the browser property tab and set the shortcut key like this. It will save lots of your time.
I hope this tips make more productive while working with browser.
Step 1: Create the database as per as your requirement
Step 2: Install the EF Core Power Tool in Visual studio like this
Step 3: Go to the solution explorer and right click on it then EF Power Tool then Reverse Engineer as given below image
Step 4: Select the database name like this
then click on OK
Step 5: Select all the required table which one we are going to use in application
Step 6: Now Select the namespace and context name like given below
Step 7 : Click on OK. Now this tool will generate the required model and context file in Data folder.
If we have asp.net mvc 5.0 application and we are searching some different page on browser then we will get the exception message.
“The resource cannot be found” I.e HTTP 404 status code.
To display this error message as user friendly we can install the “NotFoundMVC” Nuget package in Visual studio like this
Now go to the web config file and delete the this line of code. This is the problem in this NuGet package, which is creating some invalid code in web config file.
Now this package will create the Not found page for you.
This will also add the required code in web config file like this
Now run the application with wrong controller/Action name. It will give user friendly error message like this
Limitation of Control
This control does not handle the other error message. It will handle on status code 404. For other error we have to implement separate error handle approach.
I hope this post will help to implement the user friendly error message for http status code 404.