Identity in .NET API Makes Auth Easy

There was a time to be scared of the auth in ASP.NET. Identity really makes it easy. But before delving any further, let’s keep the tradition alive by knowing the ancient Roman history of auth in ASP.NET. How Auth was done earlier? Manual Token Generation: Developers manually created JWT tokens using libraries like System.IdentityModel.Tokens.Jwt and hardcoded key management. No Built-in User Management: Handling user registration, login, password hashing, and role management required custom code. Manual Claims Management: Claims (roles, permissions) were added to JWT tokens manually, increasing the risk of errors. Token Validation: Developers manually validated JWT tokens in each request, including signature, expiration, and claims validation. No Built-in Features for Role Management: Handling user roles and claims for authorization were complex It’s not uncommon to see code like this even today (there continue to be valid use cases, of course). ...

Dotnet 6 is Refreshingly Simple

There are numerous things to love about the new .NET 6, but for me one key thing stands out - .NET now seems more approachable than ever! Take a straight-forward example. A new .NET Web API project would look like this - A startup.cs file with generated code A Program.cs file with more lines of code A lot of other files The two file dependencies induced that warm fuzzy feeling in ASP.NET developers for sometime now. ...

A quick start on ASP.NET Core Razor Pages

Here’s a quick introduction to Razor pages in ASP.NET core, and an opinionated way to quickly start building applications using Razor pages. And yes, there is a case for using Razor pages even in 2020. So.. ASP.net? Yes, indeed. I have had a love-hate relationship with ASP.NET through years. I am way less productive using ASP.net but cannot ignore the speed that a dotnet web server provides. Take into account the super debugging capabilities/tooling and the sizeable market that keeps providing projects on the platform, we surely have more than a winner in ASP.NET. ...

Hosting Models for Blazor

Blazor has three hosting models - as I see it :) Server Client Client++ We will look at them in brief below. Server Server hosted implies the entire application being hosted on server. A razor-thin (no pun) app is delivered to client and there on client relies on server for everything. I mean everything - All clicks, user input, gestures etc. will be transferred to server through a SignalR connection. Server figures out what to do Server does DOM diffing, keeps track of updates that are done client-side and what should be sent to client. Server delivers those changes to client over the ever-persistent SignalR Server sees any connection drops and maintains state if client reconnects Client reacts, and keeps reacting with help from server Can work on older browsers (though, to be frank, if you are using old browsers - you should be upgrading old browsers and the apps rather than reading this article) Though this may sound primitive, but works wonderfully well - provided you have good connectivity to server and a fast-enough server. ...

Blazor for Production Anyone? Preview 7 is Released

Blazor is a big part of why I am looking forward to .NET 3.0. That’s one of the reasons I try to play around with the individual releases. Though Release 6 (I think ) caused some pain, the release schedules seem to be good as previews. As I understand - the ASP.NET Core team had been working on ironing out issues and making the application ready. That has come to a larger milestone since Release 7 has been out for a week and it is said to be ready for production. ...

Blazor and what it means for web development

As a web developer I am amazed on web assembly and what Blazor could do with it. And, I am saying that even though I absolutely love what Javascript can do. The Back Story I had been hearing about this Microsoft experiment with web assembly (WASM) for quite sometime, but got an opportunity to take a further look starting late 2018. This was the time when news of Blazor being released as part of .NET Core started going rounds. At a later time this was expected to be server side Blazor. I can’t find the patience to go over the messaging confusion with Razor pages, Razor components, server-side and client-side Razor / Blazor. We will get back to that topic at some time. ...