How to use Identity Pages in ASP.NET MVC Applications - Edit the register and login page

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to tutorial to you my name is Yannick and in this video we're going to take a look on how you can find the so-called identity related pages in asp.net core MVC applications now before we start if you are interested in more.net or asp.net related videos make sure to subscribe to our Channel and to let us know in the comments below what exactly you are interested in [Music] so if you set up a default MVC asp.net core application you know that register page your net login page but if you take a look at Visual Studio there is no way no page you can simply click on and edit these templates right here so the fix for that is pretty simple you only have to import the so-called scaffolding elements now let me show you how you can do it simply right click on your application as you can see it in the solution Explorer right now click on ADD and then click on new folded item now a new window will pop up and you want to click on identity now after clicking on identity select it and click on it just give it a second to load and the new window will pop up where you can really specify what exactly you want to import here you can see a huge list of all identity related Pages including the login page the logout page the register page the lock out page right so if you fail too many times during login you get locked out and many other things you also got that account slash manage so those are the pages where you can change your email address and all of that after logging in so whatever identity related page you're looking for you can find it right here here so let's say we want to change the register page in that scenario I want to set a check mark here at account slash register and then I want to select the correct data context so since I just created that application it did not create any custom DB context I simply stick around with the default created one the next thing that we have to do is to Simply click on ADD afterwards it will just take a couple of seconds until the new page is loaded and once that's done you can see that scaffolding read me txt popping up telling you that support for asp.net core identity was added to your project and the areas on the right side that's the most important part here open up identity in pages so this is pretty new so the account folder that's the new one and inside here you can now see the register see it's HTML now very important to mention is that those are razor pages so if you open up again so fold out that register sees HTML you can find a so-called code behind file now you're here visiting this video because you're interested in asp.net core and I want to show you our unique online course on how to master asp.net current angular to become a full stack c-sharp developer to increase your programmer market value helping you to land your first job or increase your salary as a developer so this is the fastest way on how you can progress as a c-sharp programmer so if you really want to dig deeper into asp.net core go ahead and check out the link in the description regarding that we call it the c-sharp progress Academy or you can simply click on the info card popping up right now on the top right corner this course is absolutely unique and not comparable to any other online course that you have so far worked through so check it out right now and I see you there what that basically means is if you open it up you can find a c-sharp file which is well inherited or that class is inherited from the page model class so inside here you can see the structure like the input fields or the required data that you need for registration which then gets sent to the cshtml right here and gets used nearly everywhere using the asp4 for example so in that input field we have that asp4 input email and we can find that in the so-called code behind file of it right so we just have to search for it there it is input email so this is exactly what it is now however for sure you can now feel free to change and make adjustments whatever you like or however you like inside of that new register CS HTML page for example let's simply say that we want to have another input field here for the name so we would go to the code behind file and here you can see input model here's our email address we can simply copy that over and want to say email we can simply say name for example it's also a string name there we go and now we could switch to the front end again let me just save that here and where our email is I also want to copy that over into the next line just like that so just for demonstration and now we can say name right so this is not provided there we go awesome so form control autocomplete username we can remove that it's not really important and we for sure want to have the validation for name two here not free mail there we go and if we now take a look at our page again you can now see that it contains a new field called name so we successfully made changes here now if you really want to have that working that name we should go ahead and take a look here on the get async and on post async just two sentences regarding that on get is the moment when the page is loaded so that data can get fetched and on post async is the moment when you submit the form on that cshtml page so since this Razer page right and we have that form here so once you submit that form that on post async will get called and inside here you can see that we are referencing the input email to create a user right because we're on the register page and all of that so here in that part of the code well it looks more complicated than it is but here in this part of the code we would also go ahead and use the name for our custom user if we would have one basically however the point of this tutorial was to show you how to find those identity Pages like register login and all of that and now you know how to import them and how to successfully make changes and in addition to that you also learned a little bit about Razer pages and the code behind files alrighty so now you know how to import and edit those identity related Pages if this video helped you out make sure to give it a thumb up and for sure to subscribe to our channel so that you no longer Miss any.net related videos and for sure check out our c-sharp progress Academy 21 days learning angular and asp.net core you can for sure do it in your own speed and I see you next time in the next video thanks for watching [Music]
Info
Channel: tutorialsEU - C#
Views: 6,777
Rating: undefined out of 5
Keywords: dotnet, csharp, dotnet core, .net core tutorial, .net core, .net, c#, Tutorials, Tutorial, Programming, Course, Learn, Step by step, guide, programmer, core, code, c sharp, sharp, net6, 6.0, .net framework, programming, visual studio, programming for beginners, coding, how to code, dot net, c# programming, tim corey, identity, dependency injection, aspnet core, backend developer, software development, entity framework core, entity framework, authentication, razor pages, aspnet core identity
Id: fCS5LLOs3Qg
Channel Id: undefined
Length: 6min 43sec (403 seconds)
Published: Mon Nov 21 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.