Saturday, April 24, 2010

Create a Login Form in ASP Net

17 comments:

  1. i also write shared dr As SqlDataReader
    but error again

    ReplyDelete
  2. try after
    removing brackets
    dr = cmd.ExecuteReader

    ReplyDelete
  3. Sure i will make a video on LOGIN in ASP(vb)

    ReplyDelete
  4. great work man..i just would like to know how do we authorize roles for users after login

    ReplyDelete
  5. i made connection between both my asp page and sql server..but when i execute it shows an error on the term "con.open"..plz give me the solution.

    ReplyDelete
  6. i have one problem actually i make a project in .net n i have one problem in my project a data entry from is present so many enteries like sender and receiver detail is present them my form is not look well so i want user fill this entry in step but data save in same table then plz tell me solution of my problem

    ReplyDelete
  7. you can use sessions to store values on one page and insert all values at one page.... if i got time i vll show you through a video

    Thanks

    ReplyDelete
  8. i have a one problem in my project display table data in form using gridview but in
    table countryid are stored i want to display a country name in grid
    view and that country name stored in xml file then how to fetch the
    country name in xml file plz give me solution through video

    ReplyDelete
  9. hai emmu..i am ram from chennai..im doins a 'project online movie ticket booking'..i need a code and method for seat selection..im doing it asp.net with c# code..can u plz help me..

    ReplyDelete
  10. Thanks a lot..I have learnt a lot from ur tutorials..very useful..I have a request..Please put a tutorial on login using salted has algorithm and user roles..May God Bless you..

    ReplyDelete
  11. I have followed your tutorial but I can not login with the correction login details. Wrong password error shows all the time. Can you help?

    My code is below, I can't see any difference between your code and mine!

    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;

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

    }

    SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Documents\\Visual Studio 2010\\WebSites\\forum\\App_Data\\forum.mdf;Integrated Security=True;User Instance=True");
    SqlCommand cmd;
    SqlDataReader dataReader;

    protected void Button1_Click(object sender, EventArgs e)
    {
    con.Open();
    cmd = new SqlCommand("SELECT Password FROM members WHERE Username='" + txtUsername.Text + "'", con);
    dataReader = cmd.ExecuteReader();
    if (!dataReader.Read())
    {
    Response.Write("Wrong Details");
    }
    else
    {
    if (dataReader[0].ToString() == txtPassword.Text)
    Response.Redirect("index.aspx");
    else
    Response.Write("Wrong Password");
    }

    }
    }

    ReplyDelete
  12. Is should work Paul check your Database Values?

    ReplyDelete
  13. Hi Emmu,
    can u plsz help me to find wats wrong with the code......
    SqlConnection con = new SqlConnection(@"Data Source=HARISHPRAVEEN\SQLEXPRESS;Initial Catalog=flavourzsfoods;Integrated Security=True");
    SqlCommand cmd;
    SqlDataReader dr =null;


    protected void Button1_Click(object sender, EventArgs e)
    {
    con.Open();
    cmd = new SqlCommand("SELECT * FROM login WHERE username= '" + TextBox1 + "'", con);
    dr = cmd.ExecuteReader();
    if (!dr.Read())
    {
    Label1.Text = "Wrong detials";

    }
    else
    {
    if (dr[0].ToString() == TextBox2.Text)
    Response.Redirect("makeorder.aspx");
    else
    Label1.Text = "Wrong detials";

    }
    }

    ReplyDelete
  14. hi emmu,
    i posted the above comment....
    Even i enter the correct details it shows as "wrong detail ".......
    plsz help me

    ReplyDelete
  15. hi emmu,

    i am following you from last two months. i have learned a lot but i have a small problem i am not getting the sql server 2008 browser. i have configuration tools as configuration manager,installation tools but i am not getting web browser can you please let me how to get the browser

    ReplyDelete
  16. SqlConnection con = new SqlConnection("Data Source=AFVAN;Initial Catalog=login;Integrated Security=True");
    SqlCommand cmd;
    SqlDataReader dr;
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
    string un = "";
    un=TextBox1.Text;
    con.Open();
    Response.Write("connected");
    cmd = new SqlCommand("select * from login where username='un'",con);
    dr=cmd.ExecuteReader();//error here that the connection property is not initialised
    if (dr.Read())
    {
    Label1.Text = "USERNAME AVAILABLE";

    }
    else
    {
    Label1.Text = "NOT AVAILABLE";
    }

    ReplyDelete