How to create Custom Login Registration in Asp.Net MVC 5 (Code First)

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 276

  • @OpenEducationChannel
    @OpenEducationChannel  ปีที่แล้ว +4

    Here is the Video link for new video for custom login & registration using Asp.Net Core: th-cam.com/video/712G-iQ1zzg/w-d-xo.html.
    Thanks all for your positive comments. I have seen many people are saying that they are facing "The name Session doesnot exist in the current context" error. In most cases this error comes when session is not available. This video was created with Asp.Net MVC using .Net Framework 4.6. In case, if you are using .Net 6/Core MVC version, then session usage is little bit different. So if you are using .Net 6, then try to use HttpContext.Session.SetString("UserId") instead of Session["UserId"] and so on. Although you can face some other issues, as these two .Net Framework versions are different.

  • @eespiedrop2
    @eespiedrop2 6 ปีที่แล้ว +3

    I found this video very useful. I am just starting to learn MVC so it has given me a great starting point. Thanks for taking the time to post this.

    • @OpenEducationChannel
      @OpenEducationChannel  6 ปีที่แล้ว

      Thanks and welcome.

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      Hi ! I did in this video. How do I add AngularJs to the client side?

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      @@OpenEducationChannel Hi ! I did in this video. How do I add AngularJs to the client side?

  • @fawad0301
    @fawad0301 8 ปีที่แล้ว +2

    Thanks for making such video, It is very informative video, plz make it for multi roles like "Admin, User, Accountant, Storekeeper" with own areas......

  • @E_N_D_E_R
    @E_N_D_E_R 3 ปีที่แล้ว

    Still works 100% in Visual Studio 2019 using newer methods and whatnot

  • @tvuong2003
    @tvuong2003 8 ปีที่แล้ว +3

    SO thankful for this video. It is great and so easy to follow. Please post more MVC videos.

  • @sarveshr
    @sarveshr 7 ปีที่แล้ว

    Very useful tutorial for beginners....gr8 stuff...thank you

  • @aarcheeecya
    @aarcheeecya 8 ปีที่แล้ว

    Really Nice... Explanation... i setup my app using your instructions.

  • @sambsonmarcellinrazanadahy5633
    @sambsonmarcellinrazanadahy5633 2 ปีที่แล้ว

    Thank you, it is very useful. Enjoy on it

  • @emersonstori
    @emersonstori 7 ปีที่แล้ว +1

    Congratulations, simple and objective

  • @mansourzekria20
    @mansourzekria20 7 ปีที่แล้ว

    Thank you very very much for you clear instructions .. It was very help full.

  • @komalshehzadi1325
    @komalshehzadi1325 5 ปีที่แล้ว

    ThankYou So much It Is very Help full For Mee GoodJob..

  • @jgabrielbernardo964
    @jgabrielbernardo964 5 ปีที่แล้ว

    i will be forever gratefull for this tutorial

  • @dataone7170
    @dataone7170 2 ปีที่แล้ว

    Love you from india

  • @islamabbas9816
    @islamabbas9816 5 ปีที่แล้ว

    thanks a lot for this tutorial it's helped me very much

  • @davidgruby1704
    @davidgruby1704 7 ปีที่แล้ว

    Excellent, found it very useful and helped "demystify" MVC :)

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @utdfkc
    @utdfkc 8 ปีที่แล้ว

    Fantastic knowledge. Can You Explain How to Connect Existing SQL DATABase register table...

  • @imjaypz
    @imjaypz 8 ปีที่แล้ว

    That would be great if you include the log out feature. :)
    But anyway, thanks for your tutorial. Problem solved. :)

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @ingosmalose
    @ingosmalose 3 ปีที่แล้ว

    it's a great video, but I really appreciate if you could show us how to make this login connected from the database

  • @iqrabashir904
    @iqrabashir904 7 ปีที่แล้ว

    Thanks a lot.......its easily understandable

  • @alexpatel2930
    @alexpatel2930 8 ปีที่แล้ว

    Very useful.thank you for sharing

  • @mathewgodly894
    @mathewgodly894 7 ปีที่แล้ว

    Simple explanation, thanks

  • @JahangirAlam-dl9tw
    @JahangirAlam-dl9tw 5 ปีที่แล้ว

    so nice tutorial ,thanks

  • @ahmedsamra1320
    @ahmedsamra1320 6 ปีที่แล้ว

    Thanks so much for your time and consideration in this matter

  • @Procyon58
    @Procyon58 8 ปีที่แล้ว

    Thank you so much for this video you helped me tremendously!

  • @dataone7170
    @dataone7170 2 ปีที่แล้ว

    Thank you sirrr

  • @neko419
    @neko419 8 ปีที่แล้ว

    Very useful tutorial. Thank you man!

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @marcosmessias8824
    @marcosmessias8824 5 ปีที่แล้ว

    thanks for share knowledge

  • @aplikasikependudukanbipabi6308
    @aplikasikependudukanbipabi6308 ปีที่แล้ว

    Very2 helpfull

  • @veronicagutierrez2571
    @veronicagutierrez2571 8 ปีที่แล้ว

    Excellent tutorial, worked perfect for me!! :)

  • @purecrafttube5218
    @purecrafttube5218 8 ปีที่แล้ว

    so helpful but how do you get the data to go into the database im kinda new to this stuff

  • @kubraaydn3451
    @kubraaydn3451 4 ปีที่แล้ว

    Hi ! I did in this video. How do I add AngularJs to the client side?

  • @danieladigun2696
    @danieladigun2696 7 ปีที่แล้ว

    this is amazingly simple. Thank you for this.

    • @subhashg3659
      @subhashg3659 4 ปีที่แล้ว

      I need a help sir.can u send a gmail and password format which can be given in registration page this is the error which I am facing a lot

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      Hi ! I did in this video. How do I add AngularJs to the client side?

  • @scshil
    @scshil 7 ปีที่แล้ว

    Thank you helps me a lot.

  • @stannisbarracuda5693
    @stannisbarracuda5693 6 ปีที่แล้ว

    thanks so much you helped a lot, great tutorial

  • @eneses14
    @eneses14 7 ปีที่แล้ว

    it worked perfectly, i can do the modifications for the rest thanks :)

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      Hi ! I did in this video. How do I add AngularJs to the client side?

    • @royalrajput9567
      @royalrajput9567 4 ปีที่แล้ว

      @@kubraaydn3451 you can add angularjs by adding its script file in applications and then add the link of that file in the page you want to use AngularJS

  • @KazzProx
    @KazzProx 8 ปีที่แล้ว

    Great tutorial! Thanks alot.

  • @muratcoskun4498
    @muratcoskun4498 6 ปีที่แล้ว

    Thank you for very usefull infos :)

  • @guitarleoflash
    @guitarleoflash 8 ปีที่แล้ว

    thank you for the video sir

  • @coder1807
    @coder1807 ปีที่แล้ว

    in my opinion, Session[""]=user..ToString() should be changed that: HttpContext.Session.GetString("").In my case, i fixed those bugs.

  • @xgraph2496
    @xgraph2496 7 ปีที่แล้ว

    When i clic in the login button que app does not doing nothing. just stay in login. where i can find the bug ?
    Excellent video!!

  • @ruwanc2003
    @ruwanc2003 8 ปีที่แล้ว

    You do grate, thanks

  • @arabindapasta4236
    @arabindapasta4236 5 ปีที่แล้ว

    Greate tutorial

  • @jensjonkman8428
    @jensjonkman8428 9 ปีที่แล้ว

    Thank you great tutorial

  • @mrkalykuuber
    @mrkalykuuber 6 ปีที่แล้ว

    This is very clean and good tutorial but not recommended for bigenners

  • @m.shoaibomer7822
    @m.shoaibomer7822 6 ปีที่แล้ว

    very good ....!

  • @saya6sullivan
    @saya6sullivan 8 ปีที่แล้ว

    Brilliant tutorial ^_^ Thank you

  • @MdSohelRana-zv5wm
    @MdSohelRana-zv5wm 5 ปีที่แล้ว

    very good

  • @AndresRodriguezIGN
    @AndresRodriguezIGN 8 ปีที่แล้ว

    Thanks for the tutorial :)

  • @Andrews19jon
    @Andrews19jon 7 ปีที่แล้ว

    Thanks so much man!

  • @nietoroger
    @nietoroger 8 ปีที่แล้ว

    Great tutorial!!!
    Can you publish the project?

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @allanrasmussen5789
    @allanrasmussen5789 7 ปีที่แล้ว

    Nice, but can uoy try to make it with a Mysql insted so it bee more autentick

  • @vbhostir
    @vbhostir 8 ปีที่แล้ว

    Thanks man.

  • @eXteVlad
    @eXteVlad 7 ปีที่แล้ว

    thank u so much!

  • @ghantavikas
    @ghantavikas 7 ปีที่แล้ว

    Thank you Sir.

  • @kyriefajardo7012
    @kyriefajardo7012 8 ปีที่แล้ว

    Thank you!

  • @rajkumavat6031
    @rajkumavat6031 5 ปีที่แล้ว

    Thanks for this tutorial but How we can see database is created any tool ? and how can upload this project with database on Server ?

  • @atulkantale6186
    @atulkantale6186 8 ปีที่แล้ว

    nice tuto

  • @rahulsaha6437
    @rahulsaha6437 7 ปีที่แล้ว

    Why do we need 2 (overloaded) functions for register and login?

  • @angadhanappa8934
    @angadhanappa8934 8 ปีที่แล้ว

    super....

  • @DanielLee-xo2op
    @DanielLee-xo2op 7 ปีที่แล้ว

    If I use DB first, How can I add validation data annotations for each attributes of a table ?

  • @Yuvraj622
    @Yuvraj622 8 ปีที่แล้ว

    thanks buddy

  • @rodrigo6459
    @rodrigo6459 5 ปีที่แล้ว

    As a starting point it works... but i will NEVER use this kind of login/registration in a real application working in production.. passwords and not hashed and there are a lot of issues, for example.. how to restrict "non registered" users from viewing a page. OWIN offers a better way to do this but it is really complex and i'm still looking for a good tutorial that does not REQUIRES me to create a new ASP.NET MVC App, since i have a working application and i need to implement user validation.

  • @avibalulu150
    @avibalulu150 9 ปีที่แล้ว +1

    hay , excellent !next time add the code :)

  • @ismatullahfaryaadi7748
    @ismatullahfaryaadi7748 5 ปีที่แล้ว

    How to use the MVC own Login and redirect to DashBoard?

  • @balacool1
    @balacool1 7 ปีที่แล้ว

    Thanks Bro :)

  • @meghamisra5622
    @meghamisra5622 7 ปีที่แล้ว

    I create login page as you have shown in this video no error working fine the only thing I can not see is data into my database table can you please let me know what I have done wrong??? I rally want to do it ASAP
    thanks

    • @OpenEducationChannel
      @OpenEducationChannel  7 ปีที่แล้ว

      Data is not saved in database or you can not connect to database?

    • @meghamisra5622
      @meghamisra5622 7 ปีที่แล้ว

      I connected I can see the connection but data is not saving in database.
      I can see on page but not in database

  • @kaizartariq9531
    @kaizartariq9531 8 ปีที่แล้ว

    thanks for the tutorial, can u please give me how to make username unique?

  • @shirajnadaf4515
    @shirajnadaf4515 5 ปีที่แล้ว

    Thanks

  • @senzochiya4483
    @senzochiya4483 6 ปีที่แล้ว

    can you please do the same tutorial using view models

  • @ABMA79
    @ABMA79 7 ปีที่แล้ว

    I do have a question though, how come he didnt do enable-migration since a declaration must be made first and according to my knowledge, using entity framework requires you to do the following first before moving to controllers:
    1- enable-migrations
    2- add-migration
    3- update-database
    he didnt do any of that,
    does that mean the process of migration can be done automatically by visual studio?
    please someone clarify this point for me

    • @mariemcdonley3464
      @mariemcdonley3464 6 ปีที่แล้ว

      enable-migrations is required if you make changes to your model or another model..

  • @9263STYV
    @9263STYV 8 ปีที่แล้ว

    Hi thanks for sharing the tutorial. Just one issue. Where can find the database table? The account data should be recorded somewhere, but i cannot find it. Does anybody find this issue?

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว

      You can find it in "C:\Users\" location. There would be database .mdf files, for name of the database you can see the web.config.

    • @9263STYV
      @9263STYV 8 ปีที่แล้ว

      thanks a lot, I found it.

  • @techjat8405
    @techjat8405 6 ปีที่แล้ว

    Excuse me Sir. You created a Dbcontext class object. Dbcontext is of which class.

    • @OpenEducationChannel
      @OpenEducationChannel  6 ปีที่แล้ว +1

      DbContext class is provided by Entity Framework. We inherit our database context class from DbContext. Our Database context class contains all mapping of tables and relation between them.

    • @techjat8405
      @techjat8405 6 ปีที่แล้ว

      @@OpenEducationChannel thanks for your reply

  • @noorulhira
    @noorulhira 4 ปีที่แล้ว

    The users have to register himself with the site before using the
    functionality. After registrations user id and password will be
    provided to the user. Through which he can login. first step ye hai is me kya krna hai kch pta hai

  • @kubraaydn3451
    @kubraaydn3451 4 ปีที่แล้ว

    How can it connect database ? I want to database and table with ef code first ...

  • @ibrahimbossan2147
    @ibrahimbossan2147 8 ปีที่แล้ว +1

    HI can you please make a tutorial for log in using sql database and how to assign roles?

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว +1

      +ibrahim bossan Ok, i'll make one using MVC and MySql

    • @williamwsentamu4876
      @williamwsentamu4876 8 ปีที่แล้ว

      Assigning roles during registration of a new user

  • @srihariram5686
    @srihariram5686 7 ปีที่แล้ว

    how to solve this error
    An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was not handled in user code

  • @marcofabiopavone5027
    @marcofabiopavone5027 7 ปีที่แล้ว

    How to make User active in the application? After login I use my application, but it's not connected with account I logged in.

  • @champa78
    @champa78 8 ปีที่แล้ว

    sir please make a tutorial on email registration verification using code first..

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @ayoubproduction4212
    @ayoubproduction4212 7 ปีที่แล้ว

    please How do I make an mvc login page but connected to the Oracle database, can you set an example

  • @Jigyasup
    @Jigyasup 9 ปีที่แล้ว

    Nice one . but how can i implement this to my own database table ?

    • @OpenEducationChannel
      @OpenEducationChannel  9 ปีที่แล้ว +1

      +Jigyasu pokhrel You can merge this with your own database simply by adding properties for these classes in your database context class, just like we did at 06:18 in this tutorial. Thanks.

  • @StefanBaltov7
    @StefanBaltov7 8 ปีที่แล้ว

    Hi, can you please make tutorial for Custom Login and registration in ASP.NET MVC using Fluent NHibernate or NHibernate? Thanks.

  • @R4du21
    @R4du21 ปีที่แล้ว

    I don't have the Session class in order to store userid and username. What are the alternatives to this? I'm using .net 6

    • @RoshelJudith
      @RoshelJudith ปีที่แล้ว

      how did u fix?

    • @R4du21
      @R4du21 ปีที่แล้ว +3

      @@RoshelJudithYou have to choices:
      1. Use Identity and it will automatically generate code required for register, login and many more actions.
      2. Instead of Session, use Viewbag to pass the data to the view.

  • @AakashMishra21
    @AakashMishra21 8 ปีที่แล้ว

    How do I access this database in Visual Studio? Say I want to add a new user manually from VS?

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว

      you can access it from server explorer in visual studio.

  • @kishorchoure2522
    @kishorchoure2522 3 ปีที่แล้ว

    Vary good and easy... But if entered wrong username and password not showing error message

    • @OpenEducationChannel
      @OpenEducationChannel  3 ปีที่แล้ว +1

      Thanks, Make sure you have added validation summary on the view. Also wrap the login login in try catch and in catch add the same error, because sometimes .single gives error, or instead of .single you can use .where(u => u.Username == user.Username && u.Password == user.Password).FirstOrDefault().

  • @SURENDRABABUGURAM
    @SURENDRABABUGURAM 7 ปีที่แล้ว

    it showing OurDbContext db = new OurDbContext() is an error. what may be the issue

  • @jhonhernandez9210
    @jhonhernandez9210 6 ปีที่แล้ว +1

    Try to remember that you must always leave a link to the code.

  • @swetalpatel5236
    @swetalpatel5236 3 ปีที่แล้ว

    Session["UserId"] Not work in controller class. what is the problem?

  • @aaronnumerouno
    @aaronnumerouno 8 ปีที่แล้ว

    I tried this, how come login button doesnt work, login controller had httppost login(User user) and exact code and when clicking login it does nothing? hmm..

  • @fesu013
    @fesu013 5 ปีที่แล้ว

    Something which you have not tested is what if the password or email are wrong ? this gives an error where you never condition if the password or email are incorrect

  • @satyendrakumar1952
    @satyendrakumar1952 7 ปีที่แล้ว

    which type of database you used to store .
    plz explain ....

    • @OpenEducationChannel
      @OpenEducationChannel  7 ปีที่แล้ว +1

      It's MS SQL localDB.

    • @PassportArmagnac
      @PassportArmagnac 7 ปีที่แล้ว

      How do I change the database name to write data? I wrote "public mydbContext() : base("name=mydbtest")" but It doesn't create new db.

  • @Huszan
    @Huszan 4 ปีที่แล้ว

    The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
    I can't get this to work...

    • @Huszan
      @Huszan 4 ปีที่แล้ว

      Also - "The name 'Session' does not exist in current context"

  • @Daslicey
    @Daslicey 7 ปีที่แล้ว

    db.savechanges gives an error, it syas it cant find the function (it can find the definition save changes in ourdbcontext

  • @muhammadasadtahir284
    @muhammadasadtahir284 8 ปีที่แล้ว

    Tables are created automatically ?

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว

      muhammad asad tahir yes, code first approach creates a database if there is no database present.

  • @horchaninaceur1042
    @horchaninaceur1042 5 ปีที่แล้ว

    please about LOGOUT ?

  • @thangkoi
    @thangkoi 8 ปีที่แล้ว

    There is need to create one SQL Server connection?

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว +1

      +Thang Nguyen Van No, if you are following this tutorial then there is no need to create SQL Server connection. Entity framework will take care of it automatically and it will create a local database for you behind the scene. You can see that database in your users directory.

    • @thangkoi
      @thangkoi 8 ปีที่แล้ว

      +OpenEducation I following this tutorial and I have error below. Please help me!
      i.imgur.com/PuD9YPD.png

    • @OpenEducationChannel
      @OpenEducationChannel  8 ปีที่แล้ว +1

      +Thang Nguyen Van you have to make an object of account class then reassign the data of your account parameter to it. After that you can add. Eg:
      UserAccount newUserAccount = new UserAccount();
      newUserAccount.Firstname = account.FirstName; ( or what ever your fields are)
      db.userAccount.Add(newUserAccount);

  • @rubenmota9127
    @rubenmota9127 5 ปีที่แล้ว

    Como puedo añadir una vista para eliminar una cuenta? / How can I add a view for delete an account?

  • @mikkelpohjola6178
    @mikkelpohjola6178 7 ปีที่แล้ว +2

    Where is the database, so i can store my users there

    • @kubraaydn3451
      @kubraaydn3451 4 ปีที่แล้ว

      How can it connect database ? I want to database and table with ef code first ...

  • @meghanashetty490
    @meghanashetty490 ปีที่แล้ว +1

    its showing error in session how to rectify it

  • @meghamisra5622
    @meghamisra5622 7 ปีที่แล้ว

    I have created a new page where I'm inserting and getting data from the database.Now getting an error (are you missing a using directive or an assembly reference?) I checked everything but this error is not going.
    public DbSet pc_UPC { get; set; }
    public DbSet pc_INTERMEDIATE { get; set; }

    • @OpenEducationChannel
      @OpenEducationChannel  7 ปีที่แล้ว

      It's looks like you have not used entity framework reference in the file. Make sure entity framework is imported at the top of this file. If not solved then share you code.

    • @meghamisra5622
      @meghamisra5622 7 ปีที่แล้ว

      public MotorcraftContext() : base("name=Test_TrainingEntities")
      {
      }
      public DbSet Overpack_I_2_OF_5_BARCODE { get; set; }
      public DbSet pc_UPC { get; set; }
      public DbSet pc_INTERMEDIATE {get; set; }
      I added Context name then it worked but again I'm getting error
      The resource cannot be found.
      Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
      I am tired now dont know what to do

    • @weird2545
      @weird2545 7 ปีที่แล้ว

      Megha Misra I knw it's late but if u haven't found d solution and still have tht bug in mind about why it happened ()- have u checked that all ur tables been created or not ? if not than try out migrations and declare ConnectionString inside base() in context file. and then mention it in WebConfig file

  • @kaizartariq9531
    @kaizartariq9531 8 ปีที่แล้ว +1

    can u please tell me how to make username / email unique .?

    • @RMDetho
      @RMDetho 8 ปีที่แล้ว +1

      you can create a method that will confirm this and inside the method all you have to do is run:
      bool UserExists = db.userAccounts.Any(x => x.Username == user.username)
      It will return a true/false whether the database table userAccounts contains or doesn't contain a row where UserName column contains the username from the model (user.username)
      Same procedure is for the E-mail.

    • @milordas
      @milordas 5 ปีที่แล้ว

      or custom attribute for model, ie [IsUnique].. Google for syntax