Web Development And .Net Articles, Tutorials, Discussions

Asp.Net Core

I’ve been tinkering with different options to secure the API endpoint of one of my Asp.Net Core apps. What I end up using was IdentityServer4, primarily because my app needed Single sign-on too. But for straightforward scenarios, I think IdentityServer4 is an overkill. That’s where JWT comes in, so in this post, I’m going to … →

Asp.Net Core Model Binding has a set of attributes that gives us the ability to control from what source we want to receive the binding data. In this post I’m going to go through these attributes and show how and when you can use them. Default Model Binder Behavior The default behavior of model binder … →

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 … →

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 … →

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 … →

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 … →

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 … →

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 … →

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 … →

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 … →