Skip to main content

Posts

Showing posts with the label ASP.NET Core 2.0

Authentication using External Providers(Hotmail)

In my previous article, I wrote about how to authenticate by creating new user accounts. Now what if, anyone doesn’t want to add another pair of user id password to his memory and want to use the existing ones which he/she is using very frequently in his/her day-to-day life. Well, here comes the external providers in the picture. In this article, I won’t be covering the basics on how to create a website from scratch as it is already covered in an earlier article. So, let’s quickly jump on to the login screen and on right hand side, you will see the text as ‘Use another service to log in.’ . It  also provides a hyperlink, which will guide us on how to setup the authentication using external providers. What are external providers? There is a huge list of authentication providers. The most common one’s are Twitter, Facebook, Google and Microsoft. This list is not restricted till here as it can be any other custom provider. Throughout this article, I’ll be driving you to set

Setting up Two-Factor Authentication in ASP.NET Core 2.0

In this article, I’m going to write bit about security aspects in ASP.Net Core 2.0. Whenever you create a new ASP.NET Core application, you must notice that there is an option on dialog with a button captioned as Change Authentication and once you click on that, you will land upon a dialog having below 4 options as shown below:    I’ll discuss about each of these options in detail but as of now, to get started, let’s take a high-level idea about these No Authentication – which means application is completely anonymous and open for everyone to access it. Individual User Accounts – it uses local database for storing the information related to user. Work or School Accounts – it means application will work with Office365, Active Directory, support for cloud, etc.. Windows Authentication – For internet application and uses IIS capabilities to know who has logged in. Here I’ll be choosing my option as ‘ Individual User Accounts ’ which is very easy, simplest as well

All about Tag Helpers in ASP.NET Core 2.0

This time rather than jumping directly into the topic, let's have a look at the Login form code which you must have definitely seen while working on MVC application. What do you think about the above code snippet? Indeed, it works alright, but there are few problems with this. But the major problem is its a bit messy and difficult to read due to excessive use of @. So, now we have understood the problem, what is the solution? Here comes the Tag Helpers for our rescue. Let's quickly have a look at the code generated by the ASP.NET Core framework for the same functionality: The above code looks much cleaner. Isn’t it? If it looks interesting to you, we should learn more about it. What are Tag Helpers Tag Helpers are classes written in C# but are attached to HTML elements in order to run server-side code from Razor view. In other words, view created in HTML has its presentation logic defined in C#, which is ultimately executed on the w