Skip to main content

Login-page-coding-in-dotnet-using-C#

CODING OF LOGIN PAGE IN C#:

Login-page-coding-in-dotnet-using-C#

Login.aspx.cs:

Notes:-
1. You have create user interface using visual studio as in screen shot.
2. double click on login button and write down the below coding on button click event.
3.Here database name is JOB.
4. Table name is userregistration.

//first of all include all namespace 
//these has been added automatically in Visual Studio.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;


public partial class Login : System.Web.UI.Page
{

   
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        //connection string
        SqlConnection con = new SqlConnection("server=localhost; database=JOB; Integrated Security=True");
        SqlCommand cmd = new SqlCommand("select * from userregistration where username=@username and 

password=@password", con);

        cmd.Parameters.AddWithValue("@username", text_username.Text);
        cmd.Parameters.AddWithValue("@password", Text_password.Text);
        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            Session["uid"] = dr["email"].ToString();
            Session["name"] = dr["username"].ToString();
            Response.Redirect("jobseeakerwelcome.aspx");

        }

        else
        {
          
            Label1.Text = "invalid username password ";
        }
     
    }
    }

Comments

Popular posts from this blog

Join the Beauty Course for Massage Beauty License Training

Massage Beauty School of California: Massage beauty program is one of the top ten beauty courses which are well recognized and sought after in the beauty sector. Several students from various cities and states enroll in this training program to get better learning opportunities and understand the minute technicalities of beauty massaging services. Certified schools and beauty institutes located in Los Angeles are offering cutting-edge training to the students who are eligible for the program. Palace Beauty College is an accredited beauty school that does offer a massage therapy program and also offers holistic learning facilities to the students. The college has years of experience in providing massage therapy license training in Los Angeles for more than half a decade now. The college maintains its official website to reach out to distant students and provide them relevant information related to the available beauty courses. The college takes pride in its impressive infrastru...

Having issue with MDaemon Outlook Connector to connect MDaemon data with Outlook

Migration from MDaemon to Outlook is the right way to access MDaemon data in Outlook by using Outlook Connector Migration from MDaemon to Outlook Without Outlook Connector Migration from MDaemon to Outlook Overview: MDaemon Mail Server provides Outlook Connector for MDaemon which let you view and open MDaemon data with Outlook. Using Outlook Connector users will be able to view MDaemon Mail and contacts in Outlook. But if have you deleted any file from MDaemon then it will also missing from Outlook as well.   The way MDaemon Outlook Connector works is by keeping a locally cached copy file of the mail body in a database and the attach   files as a separate file. This is completely different from Microsoft Outlook Exchange caching where everything is kept in one OST file. The problem with this is it takes around 30 minutes to open Outlook (from a cold boot) which is quite unacceptable!! Sometimes users couldn’t able to send and receive email while using Ou...

Most frequently asked interview question on String in java

 Here we describe difference between (==) and .equals() :- Both of them very much  differ  in their significance and working as equals() method is present in the java.lang.Object class and it is expected to check for the equivalence of the state of objects! That means, the contents of the objects. Whereas the '==' operator is expected to check the actual object instances are same or not. Let us see an example we have two String objects and they are being pointed by two different reference variables as a1 and a2. a1 = new String("xyz"); a2 = new String("xyz"); Now, if you use the "equals()" method to check for their equivalence as if(a1.equals(a2)) System.out.println("a1.equals(a2) is TRUE"); else System.out.println("a1.equals(a2) is FALSE"); You will get the output as TRUE as the 'equals()' method check for the content equivality. Lets check the '==' operator.. if(s...