How to Create Login Page in Asp.Net Web Form With Sql DataBase

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • 🍒 Related Videos
    Asp.Net Core MVC Tutorials: • Asp.Net Core MVC Tutorial
    MVC Login & User Registration: • Asp.Net Core MVC & Ide...
    CRUD in Asp Web Form: • C# Asp.Net Web Form CR...
    Bind GridView in Asp Web Form: • Asp.Net Gridview : Bi...
    GridView CRUD in Asp Web Form : • Asp.Net Web Form Gridv...
    jQuery DataTable Playlist with Asp Web Form: • jQuery Datatable and A...
    More Asp.Net Web Form Tutorials: • Asp WebForm MVC Tutori...
    📂 GitHub Repository
    ► goo.gl/24sG2F
    💖 Buy me a Coffee
    ➤ bit.ly/3L36ut4 (PayPal)
    ➤ bit.ly/3VF0iPT (Razorpay)
    🔗 Find me in
    Udemy : bit.ly/3RtyQSB
    Facebook : / codaffection
    GitHub : github.com/cod...
    Discord : / discord
    Twitter : / codaffection
    ---
    How to Create Login and Logout Page in Asp.net using SQL server database.
    The tutorial discusses the following points :
    - Create Login Page in asp.net webform
    - Logout in Dashboard( Home Page)
    Login-Logout System(user authentication) is implemented using a session.
    #AspNet #CodAffection

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

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

    goo.gl/bPcyXW : Buy me a Coffee
    bit.ly/30fPDMg : AspNet Core MVC Tutorials
    bit.ly/403lUVC : MVC Login & User Registration
    bit.ly/2Z7PI3e : CRUD in Asp Web Form
    bit.ly/3Z5uWUR : jQuery DataTable Playlist with Asp Web Form
    bit.ly/2TA9N14 : GridView CRUD in Asp Web Form
    bit.ly/2MlkMuM : Login in Asp Web Form
    bit.ly/3yTsztF : More AspNet Web Form Tutorials

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

    I've seen thousands of videos, and yours is the only one that helped me, thanks (google translate)

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

    Hi, for my project, it keep ahowing error and pointing to the sqlCon.Open(), any solution for me😭

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

      im trying to resolve the issue with this too.. its something to do with the data source..

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

    Thanks sir, aapne bahut hi simple taraikee se btaya .... Thanks for helping me

  • @NidhiSharma-pt5ze
    @NidhiSharma-pt5ze 4 ปีที่แล้ว +1

    there is an error in int count = Convert.ToInt32(sqlCmd.ExecuteScalar());

  • @theegeek2220
    @theegeek2220 หลายเดือนก่อน

    7 years later I'm still using the video. S/O to you

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

    MAN!!! THANK YOU VERY MUCH!! This is just miracle!!! Could you please post more videos about ASP.NET Webforms?

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

    I'm getting an error as invalid object name 'userDetails' in the execution time and at the line of int count=Convert.ToInt32(cmdExecuteScalar());
    Can anyone please help.....

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

    Thank you sir ..helps alot for beginners

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

      you are welcome. let me know if you have any asp.net related topic suggestion for future videos.

  • @happiestmeinworld
    @happiestmeinworld 5 ปีที่แล้ว +2

    Can u add a video like after login page...showing the user details.on that page we edit the details like that.

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

    Best coding channel🔥👌

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

    Exactly what I was looking for! Thank you so much!

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

      Glad you found the video helpful.

  • @Miguel-gm9hx
    @Miguel-gm9hx 6 ปีที่แล้ว +2

    Thank you very much! You solved all the problems for my school project!!

  • @kavitasharma-yr2gc
    @kavitasharma-yr2gc ปีที่แล้ว

    Hi sir, plz guide why u type cast to execute scalar method

  • @abhishekyadav-hn1gf
    @abhishekyadav-hn1gf 2 ปีที่แล้ว

    Thanks a lot, successfully completed my page

  • @HlawulaniMaluleke-lg6mw
    @HlawulaniMaluleke-lg6mw ปีที่แล้ว +1

    Thanks for video

  • @ravimeher6067
    @ravimeher6067 6 ปีที่แล้ว +8

    I am getting error as System.InvalidOperationException: 'ExecuteScalar: Connection property has not been initialized.'
    plz help

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

      Try to add this line in top of Login.aspx.cs
      using System.Data.SqlClient;

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

    Works! thanks! ... Other published methods on the net failed: employed disabling of anonymous users, but by doing so, login page was also not allowed on 2019 visual studio.

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

    hey guys ive done everything just the same, but when i open my login page in google and fill in the credentials to login i get this error in my visual studio 2019 : System.ArgumentException: 'Invalid value for key 'integrated security'.'
    therefore i cant get trough the login page

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

    Hello, need assistance on lblerrormessage.visible = false;. Why its still showing up even if it is on page load

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

    Thenk u! Thenk U! it worked now I can add more features

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

    package konsa selct kiya tha project create karteh watq

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

    I have a quick question. so if I enter the url " .../Dashboard.aspx" directly in my navigator, it will still ask for a username and password ? or i would be able to access the page with no problemes ?

  • @a.s.8113
    @a.s.8113 5 ปีที่แล้ว +1

    Very Helpful

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

    i am getting an error like : " object reference not set to an instance of an object.'" near " lblErrorMessage.Visible = false; " help me with this

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

    Sir, may I ask if Session["username"] can be any name? Or is there id called username to use Session?

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

    Great our Job, What If I want to create a Connection Class and then call the Process in each page where I Need to Execute an SQL query?

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

    Excellent work . It is very helpful for me

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

    what if i have to retrieve only certain database....like for Admin to redirect to another page??

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

    sir your video is very helpful for me

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

    Thank you so much

  • @索尼塵無酒
    @索尼塵無酒 7 ปีที่แล้ว

    Dear Sir,
    I follow the scenario and the web works properly.
    But, if I input the incorrect account which is not existed in the database, the login goes wrong.
    How to solve this symptom? (The "Authorize" Action should be modified! I guess.)

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

    I'm having problem in SQL part like...you didn't explain that part so well and I'm confuse af... how the table was ready and everything ?

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

    Thank you for your help and your explanations!

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

    Thank you very much. Just what i'm looking for

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

    keep going bro thx

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

    boss you are the best

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

    your course is soooo helful ..... thank you so so much

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

    Great video

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

    Thank you for doing this. Great job, sir!

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

    I love your videos. Thank you!

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

    When I right-click - properties on the btnLogin and double-click the Click event, I do not get a Login.asps.c page to edit the code. I am getting a Login.aspx.vb page. What am I doing wrong? If I click on Design I see the page correctly. I am just not getting the right page to add the click event code.

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

      so you are working on VB.Net

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

      I am working (practice) on Asp.Net

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

    Best voice of the youtube!

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

      Thank you for the wonderful feedback! :) I'm humbled.

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

    Thank you dear. very much helpful

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

    Hi, do you have a method of encrypting the password or is your method secure enough?

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

      the method isnt secure for encryption use authentication and security classes they are a bit complex but most secure

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

      @@syedwasay3087 i plan to use sha1 on submit login and register. this would be an accurate approach?

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

      I used MD5 once worked like a charm, it is really easy to implement too.

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

      @@faruksmajlovic6773 ty for your feedback

  • @kennethbomholdt3433
    @kennethbomholdt3433 6 ปีที่แล้ว +2

    Thanks a lot, this was very helpful to me :-)

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

      I'm glad you fount the video helpful.

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

    Hi, thanks for your tutorial !
    Do you have any videos about login modules with encrypt password ?

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

    awesome job sir,very helpful

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

    Thank you for sharing this! Very informative. However I see that while using this query, the password can be CAPS or small letters, and it will still permit user login unless the database table tblUser has collation set to be case sensitive.

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

    thanks, i found this video very useful. nice and simple.

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

    Great Tutorial!

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

    Muchas gracias papu, me ha servido muchisimo, mis respetos :3

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

    Many many thanks for your amazing tutorial.

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

      Watch other tutorials this is out dated and considered bad practice nowadays.

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

      @@knowiz8071 I needed this for my University assignment.

  • @Animated-Corporate-Videos
    @Animated-Corporate-Videos 6 ปีที่แล้ว +1

    Hi, How are bro?
    I have a question for you, I have VB.net windows form application with MYSQL database. Is it possible to connect Firebase Database instead of SQL server with VB.NET desktop application?

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

    Thank you

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

    Thanks bro!!!
    Great tutorial :D

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

    Great you help me so much

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

    Thanks

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

    Where do you get the @Data Source line from? (7:30 in the video)

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

      Answer is here : stackoverflow.com/a/4879175/4133590

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

    Hey i know this is a long-ago video but do you have a registration and forget password tutorial

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

    Nice video bro but plz show output also after some steps it will help u understand... 👍

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

    Thank you very much

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

    This was great help! Thank you :)

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

      you are welcome. let me know if you have any video suggestion regarding asp.net.

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

    Thanks, Very useful

  • @meryemer-raki4560
    @meryemer-raki4560 6 ปีที่แล้ว

    Excellent ! thanks !

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

    Thank you Sir

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

    How to export this SQL database to CSV? Can you do a tutorial of it?

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

    Thank you very much!

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

    Great view

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

    Well done. Thank you.

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

    thanks you so much sir!

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

    Thank you soo much.. god bless

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

    LEGEND

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

    Thank you.

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

    TY

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

    A big Thanks

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

    T H A N K S ! ! !

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

    excellent tutorial

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

    int count = Convert.ToInt64(SqlCmd.ExecuteScalar());
    this line error will be occur.how to modify line

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

      check you db connection string or try with break point.

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

      CodAffection tq.

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

    HI bro, how do you hide the password? cuz your video shows the password

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

    Hi I am beginner and have NO knowledge of ASP.NET
    I viewed the video and followed the steps.
    However when clicked on login, got below error.
    Please help me here.
    Error:
    Server Error in '/' Application.
    ExecuteScalar requires an open and available Connection. The connection's current state is closed.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is closed.
    Source Error:
    Line 25: sqlcmd.Parameters.AddWithValue("@Username", txtUserName.Text.Trim());
    Line 26: sqlcmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());
    Line 27: int count = Convert.ToInt32(sqlcmd.ExecuteScalar());
    Line 28: if (count == 1)
    Line 29: {
    Source File: Q:\Prod\myproject\loginpage\loginpage\login.aspx.cs Line: 27
    Stack Trace:
    [InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is closed.]
    System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +2378748
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +91
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
    System.Data.SqlClient.SqlCommand.ExecuteScalar() +180
    loginpage.WebForm1.btnlogin_Click(Object sender, EventArgs e) in Q:\Prod\myproject\loginpage\loginpage\login.aspx.cs:27
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9659822
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +108
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0

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

      Please Check Your Sql Server Connection String

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

      Sir, It is exactly same as provided by you.
      as below:
      using (SqlConnection SqlCon = new SqlConnection(@"Data Source=(local)sqle2012;initial catalog=LoginDB;integrated security=true;"))
      {
      string query = "SELECT COUNT(1) FROM People WHERE UserName=@username AND Password=@password";
      SqlCommand sqlcmd = new SqlCommand(query, SqlCon);
      sqlcmd.Parameters.AddWithValue("@Username", txtUserName.Text.Trim());
      sqlcmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());
      int count = Convert.ToInt32(sqlcmd.ExecuteScalar());
      if (count == 1)
      {
      Session["Username"] = txtUserName.Text.Trim();
      Response.Redirect("Dashboard.aspx");
      }
      else { lblErrorMessage.Visible = true; }
      }

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

      Did you create the Sql Server DataBase LoginDB in Your System ?

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

      yes SQLEXPRESS.LoginDB

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

      do you know the sql server instance name ?

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

    I try to use sspi connection it works good on my machine but get this error on anthers machine in domain
    Server Error in '/' Application
    application error from being viewed remotely (for security reasons)
    I search a lot but get nothing
    hope ur help if u don't mind

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

      Check your DB Connection String.

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

      thanks so much for the reply - but DB connection string i guess it right coz it works well on my machine - db server is not my machine just website and iis on my machine -

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

      db is in another server machine right ?

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

      yes sir - we work on domain - theirs machine have db and my machine have website and there others

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

      can you connect server db from your local machine using ssms or visual studio?

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

    This videos s god-like!

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

      Glad you found the video helpful.

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

    Nice

  • @AnuragSharma-jx8df
    @AnuragSharma-jx8df 6 ปีที่แล้ว

    Hello if u could upload a similar video of login according to various roles then it would be a big help

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

    i am having problem in {int count = Convert.ToInt32(sqlcmd.ExecuteScalar()); } showing No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputPassword to a known managed provider native type. plz help

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

      particular stored procedure should return integer string

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

      done sir

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

    thanks

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

    You helped me again.
    Thank you from my heart

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

    YOUR NAME IS SHAMZU, DATABASE SERVER DONT LIE

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

      :)

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

      @@CodAffection Happy day to you, I am so lucky to be noticed.

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

    Thank you very much.

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

    I am getting an error message in lblUserDetails

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

    Thanks

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

    TY

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

    Thank you so much.

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

      Watch other tutorials this is out dated and considered bad practice nowadays.