ADS

Monday, September 10, 2018

Registration And login with database



Asp page 1:;

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApp.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="StyleSheet1.css" rel="stylesheet" />
    <script src="Scripts/bootstrap.min.js"></script>
    <script src="Scripts/jquery-3.0.0.min.js"></script>
    <script src="Scripts/bootstrap.bundle.min.js"></script>
    <link href="Content/bootstrap-reboot.css" rel="stylesheet" />
    <link href="Content/bootstrap-grid.min.css" rel="stylesheet" />
    <link href="Content/bootstrap.min.css" rel="stylesheet" />
    <script src="Scripts/jquery-3.0.0.js"></script>
    <link href="StyleSheet3.css" rel="stylesheet" />
</head>
<body >
    <div class="container" >
        <h1 style="font-family:"> Registation My Page</h1>
                     <div class="row main">
                           <div class="main-login main-center">
                 
               
    <form id="form1" runat="server">
              <div class="form-group">
               
                <asp:Label ID="Label1" runat="server" Text="YouName" ></asp:Label>
                <div class="cols-sm-10">
                                                       <div class="input-group">
                                    <span class="input-group-addon"> <i class="fa fa-user fa" aria-hidden="true"></i> </span>
                    <asp:TextBox ID="txtname" runat="server"  class="form-control" name="name"></asp:TextBox>
                  
                                    </div>
                    </div>
              </div>

        <div class="form-group">
               
                <asp:Label ID="Label2" runat="server" Text="Mail" ></asp:Label>
                <div class="cols-sm-10">
                                                       <div class="input-group">
                                    <span class="input-group-addon"> <i class="fa fa-user fa" aria-hidden="true"></i> </span>
                    <asp:TextBox ID="txtmail" runat="server"  class="form-control" name="name"></asp:TextBox>
                   
                                    </div>
                    </div>
              </div>
        <div class="form-group">
               
                <asp:Label ID="Label3" runat="server" Text="UserName" ></asp:Label>
                <div class="cols-sm-10">
                                                       <div class="input-group">
                                    <span class="input-group-addon"> <i class="fa fa-user fa" aria-hidden="true"></i> </span>
                    <asp:TextBox ID="txtuname" runat="server"  class="form-control" name="name"></asp:TextBox>
                   
                                    </div>
                    </div>
              </div>


        <div class="form-group">
               
                <asp:Label ID="Label4" runat="server" Text="PassWord" ></asp:Label>
                <div class="cols-sm-10">
                                                       <div class="input-group">
                                    <span class="input-group-addon"> <i class="fa fa-user fa" aria-hidden="true"></i> </span>
                    <asp:TextBox ID="txtpass" runat="server"  class="form-control" name="name" TextMode="Password"></asp:TextBox>
                  
                                    </div>
                    </div>
              </div>
        <div class="form-group">
               
                <asp:Label ID="Label5" runat="server" Text="ConformPassWord" ></asp:Label>
                <div class="cols-sm-10">
                                                       <div class="input-group">
                                    <span class="input-group-addon"> <i class="fa fa-user fa" aria-hidden="true"></i> </span>
                    <asp:TextBox ID="txtcpass" runat="server"  class="form-control" name="name" TextMode="Password"></asp:TextBox>
                   
                  
                                    </div>
                    </div>
              </div>

              <div class="form-group ">
                <asp:Button ID="Button1" runat="server" Text="Registration" class="btn btn-primary btn-lg btn-block login-button" OnClick="Button1_Click" />   
            </div>
        <div class="form-group ">
            <asp:Button ID="Button2" runat="server" Text="Login" class="btn btn-primary btn-lg btn-block login-button" OnClick="Button2_Click" />
        </div>
      
        <div class="form-group ">
            <asp:Label ID="Label6" runat="server" Text=""></asp:Label>
            </div>
      
    </form>



                      </div>
                  </div>
          </div>
</body>
</html>

Asp page2:

Login:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApp.WebForm2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/bootstrap.js"></script>
    <script src="Scripts/bootstrap.min.js"></script>
    <script src="Scripts/jquery-3.0.0.min.js"></script>
    <link href="Content/bootstrap.css" rel="stylesheet" />
    <link href="Content/bootstrap-grid.min.css" rel="stylesheet" />
    <link href="Content/bootstrap-grid.css" rel="stylesheet" />
    <link href="Content/bootstrap.min.css" rel="stylesheet" />
    <link href="StyleSheet1.css" rel="stylesheet" />
</head>
<body>
    <div class="container">
   
       <div class="row justify-content-center">
              <div class="col-12 col-md-8 col-lg-6 pb-5">

    <form id="form1" runat="server">
         <div class="card border-primary rounded-0">
                            <div class="card-header p-0">
                                <div class="bg-info text-white text-center py-2">
                                    <h3><i class="fa fa-envelope"></i> Signin</h3>
                                  
                                </div>
                            </div>
               <div class="card-body p-3">
                                <div class="form-group">
                                    <div class="input-group mb-2">
                                        <div class="input-group-prepend">
                                            <div class="input-group-text"><i class="fa fa-user text-info"></i></div>
                                        </div>
                   <asp:TextBox ID="TextBox1" runat="server"  class="form-control"></asp:TextBox>
                                    </div>
                                </div>



                    <div class="form-group">
                                    <div class="input-group mb-2">
                                        <div class="input-group-prepend">
                                            <div class="input-group-text"><i class="fa fa-envelope text-info"></i></div>
                                        </div>
                        <asp:TextBox ID="TextBox2" runat="server" class="form-control" TextMode="Password"></asp:TextBox>
                                    </div>
                                </div>

                    <div class="text-center">
                        <asp:Button ID="Button1" runat="server" Text="Login"  class="btn btn-info btn-block rounded-0 py-2" OnClick="Button1_Click" />
                                   
                                </div>
                            </div>

 
             </div>
    </form>
            </div>
        </div>
        </div>
</body>
</html>

Asppage1 cs:

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;

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

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string conn = "Data Source=JAGADEESH\\SQLEXPRESS;Initial Catalog=Jagadeesh;User ID=sa;Password=9030302074";

            String qry = "insert into Regist(name,mail,username,passwrd) values (@name,@mail,@username,@passwrd)";

            using (SqlConnection con = new SqlConnection(conn))

            {

                try

                {

                    con.Open();
                    SqlCommand cmd = new SqlCommand(qry, con);
                    cmd.Parameters.AddWithValue("@name", txtname.Text);
                    cmd.Parameters.AddWithValue("@Mail", txtmail.Text);
                    cmd.Parameters.AddWithValue("@username", txtuname.Text);
                    cmd.Parameters.AddWithValue("@passwrd", txtcpass.Text);
                    cmd.ExecuteNonQuery();
                    Label6.Text = "Data is Insert database";
                    Response.Redirect("WebForm2.aspx");

                }
                catch(Exception ex)
                {

                }
                }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("WebForm2.aspx");
        }
    }
}
Asppage2:

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;

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

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string conn = "Data Source=JAGADEESH\\SQLEXPRESS;Initial Catalog=Jagadeesh;User ID=sa;Password=9030302074";

            String qry = "select* from Regist where username= '" + TextBox1.Text + "' and passwrd = '" + TextBox2.Text + "'";

            using (SqlConnection con = new SqlConnection(conn))

            {

                try

                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand(qry, con);
                    cmd.ExecuteNonQuery();

                    Response.Redirect("WebForm3.aspx");

                }
                catch(Exception ex)
                {

                }
             }
        }

    }
}
 asp css:

#playground-container {
    height: 500px;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
}

body, html {
    height: 100%;
    background-repeat: no-repeat;
    background-image: url("https://mdbootstrap.com/img/Photos/Horizontal/Nature/full page/img(11).jpg");
    font-family: 'Oxygen', sans-serif;
    background-size: cover;
}
.h1 {
    font-size: 50px;
    font-family: 'Passion One', cursive;
    font-weight: 400;
}
.main {
    margin: 50px 15px;
}

h1.title {
    font-size: 50px;
    font-family: 'Passion One', cursive;
    font-weight: 400;
}

hr {
    width: 10%;
    color: #fff;
}

.form-group {
    margin-bottom: 15px;
}

label {
    margin-bottom: 15px;
}

input,
input::-webkit-input-placeholder {
    font-size: 11px;
    padding-top: 3px;
}

.main-login {
    background-color: #fff;
    /* shadows and rounded borders */
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}

.form-control {
    height: auto !important;
    padding: 8px 12px !important;
}

.input-group {
    -webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21) !important;
    -moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21) !important;
    box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21) !important;
}

#button {
    border: 1px solid #ccc;
    margin-top: 28px;
    padding: 6px 12px;
    color: #666;
    text-shadow: 0 1px #fff;
    cursor: pointer;
    -moz-border-radius: 3px 3px;
    -webkit-border-radius: 3px 3px;
    border-radius: 3px 3px;
    -moz-box-shadow: 0 1px #fff inset, 0 1px #ddd;
    -webkit-box-shadow: 0 1px #fff inset, 0 1px #ddd;
    box-shadow: 0 1px #fff inset, 0 1px #ddd;
    background: #f5f5f5;
    background: -moz-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #eeeeee));
    background: -webkit-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -o-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -ms-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#eeeeee', GradientType=0);
}

.main-center {
    margin-top: 30px;
    margin: 0 auto;
    max-width: 400px;
    padding: 10px 40px;
    background: #009edf;
    color: #FFF;
    text-shadow: none;
    -webkit-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);
    -moz-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);
    box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);
}

span.input-group-addon i {
    color: #009edf;
    font-size: 17px;
}

.login-button {
    margin-top: 5px;
}

.login-register {
    font-size: 11px;
    text-align: center;
}

No comments:

Post a Comment

Design

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace trn ...