Asp.Net Core has a set of action results which are intended to facilitate the creation and formatting of response data. Without a well formed correct response, our application cannot work correctly and efficiently. Therefore action results and as a whole mechanisms that are responsible for generating the response are an important part of an Asp.Net …
Asp.Net Core
Mock HttpClient Without Wrapper Using HttpMessageHandler
There is a lot of discussion on github about why HttpClient doesn’t have an interface. Despite the long winded discussion on github about the subject, I think mocking the HttpClient isn’t that hard. We can solve this problem with a wrapper, but wrappers are not a good idea when we can avoid them. Partly because …
How To Use IActionResult Abstraction To Achieve Graceful Degradation
You might have heard the term graceful degradation. It this specific instance it refers to the page usability and the fact that when you rely on some language that are not available everywhere, the page still will be usable, w3’s article define it as: Graceful degradation Providing an alternative version of your functionality or making …
Implementing Search Without Convoluted If Statements In Asp.Net MVC
In the beginning, when I start to learn C# and Asp.Net MVC, building search form was a complicated thing to do for me. The more criteria I’ve had for a search form, the harder it would get, but it was hard because I didn’t use the proper tools to do my job. Back then, I …
Retrieving Email From Google, Microsoft And Facebook External Login Provider
In this post, I’m going to show you how you can retrieve email address form the OAuth external login provider of Facebook, Google, and Microsoft in Asp.Net MVC applications. I’m not going to discuss how you can use these providers in general. For that there are some good resources already, one of them is OAuth …
Programmatically Encrypt The Connection String In Asp.Net MVC Applications
In this post, I’m going to show you how you can encrypt your connection string using code, as opposed to command line. In command line approach, you use the aspnet_regiis.exe and issue a set of commands to do the encrypt/decrypt, which you lose some flexibility, but the code approach is much cleaner and more flexible …
Security through obscurity – Hiding Asp.Net MVC response headers
Hiding sensitive response headers may not be the most important security measure that you can take, but it is one extra layer of security according to defense in depth security principle. By default, Asp.Net applications reveal too much information about its platform and version, and this information makes an application vulnerable to zero-day bugs. Suppose …
Asp.Net Core attribute routing new features and differences with MVC 5
One of the most important changes in Asp.Net Core was mixing the WebAPI and MVC. Now they are not two separate things, Asp.Net Core now contains both of them, that means these two technologies are going to share the same code base for a lot of things, and attribute routing is one of them. In …
Top 14 Must Have Free Extensions For Visual Studio 2015
These days, being a developer using Microsoft platform has become very exciting. Partly because of open sourcing of .NET and integration of its products with other great open source platforms. But also the latest free IDE that Microsoft made available has a very good set of features for non-commercial or small company use. Free IDE …