ASP.NET Tutorial 6- Create a Login website – Login page & Validating User and Password in database




About this tutorial:

Video duration: 22:58
asp.net login validation with database
c# – Validating username and password in a database in asp.net
Validating User Input in ASP.NET Web Pages Sites
Asp.Net Examples: Simple login form example in asp.net
How to create Login page/form and check username,password in database
Simple login form example in asp.net Check Username
How to implement form validation using ASP.Net 2.0
How to Validate User Login in asp.net using DataSet
ASP.NET Form to Database with Form Validation
ASP.NET Database Login
ASP.NET FormDecorator Demo – Validation and Login Controls

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

33 thoughts on “ASP.NET Tutorial 6- Create a Login website – Login page & Validating User and Password in database

    dimple divya

    (April 15, 2019 - 11:50 am)

    Sir how to create admin and user page redirection both are different means user redirect to userhome page and admin redirect to adminhome page please help me…

    francis xavier

    (April 15, 2019 - 11:50 am)

    Should password next to string is Password or password
    And also next to select small p or P

    francis xavier

    (April 15, 2019 - 11:50 am)

    Incorrect username is coming for me? Pls help

    Vorraboms

    (April 15, 2019 - 11:50 am)

    why is so hard for indian tutors to focus on the topic rather then minutia here and minutia there…

    KUNDAN GUPTA

    (April 15, 2019 - 11:50 am)

    when username is incorrect and the password is correct then it not give the error msg that username is incorrect

    Ana

    (April 15, 2019 - 11:50 am)

    Can somebody help me please… i respected the code from this video but this error keep appear:
    An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code

    JncxCloud

    (April 15, 2019 - 11:50 am)

    please next update tutorial c# … thanks…

    aayesha raje

    (April 15, 2019 - 11:50 am)

    you did not test for wrong username

    aayesha raje

    (April 15, 2019 - 11:50 am)

    two people can have same name you should check with email rather than name for existing user

    Joy Kumar Chakraborty

    (April 15, 2019 - 11:50 am)

    getting a null exception error in sql conn = new conn that line sql connection conn = new sql at the top

    Provenance Gaming

    (April 15, 2019 - 11:50 am)

    when i try to use the same TextBox id (TextBoxUser.Text) it tells me its wrong and will not let me use it

    Kisan Raj

    (April 15, 2019 - 11:50 am)

    its showing user name not correct

    Real Life

    (April 15, 2019 - 11:50 am)

    please make video on "Check if username exists in sql database if username already exists show alert if not insert value in username field"

    LEE90s

    (April 15, 2019 - 11:50 am)

    Can someone explain what temp=Convert.ToInt32(com.ExecuteScalar().ToString()); does?
    thanks

    Anonymous

    (April 15, 2019 - 11:50 am)

    Hello people, I can say, if you having an error or something . Please fix that yourself if you wanna be a programmer. That's all stupid dump people

    Erdenebayar Mr

    (April 15, 2019 - 11:50 am)

    Thank you so so much ProgrammingKnowledge

    Shung Co

    (April 15, 2019 - 11:50 am)

    this is very useful thank you

    All In One

    (April 15, 2019 - 11:50 am)

    I am getting Username is not correct error although password and username is correct

    Hadiqa Malik

    (April 15, 2019 - 11:50 am)

    i got an error on Sqlcommand com sayng sql.data.… is a type but is used as variable

    Air Apks

    (April 15, 2019 - 11:50 am)

    how to create posts page using asp.net C#

    carol muriithi

    (April 15, 2019 - 11:50 am)

    how do i do this on a server sql

    Romaine Barrett

    (April 15, 2019 - 11:50 am)

    This is tutorial is so on point

    Timothy Marcoe

    (April 15, 2019 - 11:50 am)

    When you use the replace(" ","") function, wouldn't the trim function be easier. What would be even easier than that is to do a lookup of username and password at the same time. If you can't find that combination, fail the login. I know this hides whether the username exists, but in a real world application, that's what you want.

    Loveria

    (April 15, 2019 - 11:50 am)

    sir, Source code error…what happene

    Aymie Chalouhy

    (April 15, 2019 - 11:50 am)

    where is the probleme??

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Configuration;

    public partial class login : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Login_ID_Click(object sender, EventArgs e)
    {
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
    conn.Open();
    string checkuser = "select count(*) from UserData where Username=' " + TextBox1Username.Text + " ' ";
    SqlCommand com = new SqlCommand(checkuser, conn);
    int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    conn.Close();
    if (temp == 1)
    {
    conn.Open();
    string checkPasswordQuery = "select password from UserData where Username=' " + TextBox1Username.Text + " ' ";
    SqlCommand passComm = new SqlCommand(checkPasswordQuery, conn);
    string password = passComm.ExecuteScalar().ToString().Replace(" ", "");
    if (password == TextBox2Password.Text)
    {
    Session["New"] = TextBox1Username.Text;
    Response.Write("Password is Correct");
    Response.Redirect("Manager.aspx");
    }
    else
    {
    Response.Write("Passwors is not Correct ");
    }
    }

    else
    {
    Response.Write("Username is not Correct");
    }
    }
    }

    Aymie Chalouhy

    (April 15, 2019 - 11:50 am)

    please can anyone copy this code and paste it here
    i have a problem in this code always i get "Username is not correct "

    Hamza Shakeel

    (April 15, 2019 - 11:50 am)

    I want to open a new web form when I click on that select link next to id in database in manager .aspx can u help me with that

    William Sam

    (April 15, 2019 - 11:50 am)

    how to make a password timeout in database using visual studio

    William Sam

    (April 15, 2019 - 11:50 am)

    Hi !! I am William and I have an aspx website but I want to know how to make user accounts to expire after some days of user account usage.

    kashish kanojia

    (April 15, 2019 - 11:50 am)

    username not correct is shown every time even after typing conn.close() after second else…plz help

    Maria Ali

    (April 15, 2019 - 11:50 am)

    username does not Exist coming every time…what is the solution

    Hamza Shakeel

    (April 15, 2019 - 11:50 am)

    getting this problem registration.mdf not opening plz help

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

    lakshmi priya

    (April 15, 2019 - 11:50 am)

    for me it giving error user name is not correct ,even though username is correct in database.please help me with this issue.

Leave a Reply to Shung Co Cancel reply

Your email address will not be published. Required fields are marked *