Wednesday, 9 September 2020

How to create login page without SQL in Asp.net application

 Overview:

in this article explain about how to create login page without sql database in asp.net, login verified then success the login user redirect to another page.


Step 1:

source code:

    <asp:Label ID="Label4" runat="server" Font-Bold="True" 

        Font-Names="Monotype Corsiva" Font-Size="X-Large" Text="Admin Login"></asp:Label>

</p>

<p>

    &nbsp;</p>

<p>


    <asp:Label ID="Label2" runat="server" Text="UserId"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</p>

<p>


    <asp:Label ID="Label3" runat="server" Text="Password"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>

</p>

<p>


    <asp:Button ID="Button1" runat="server" Height="32px" Text="Login" 

        Width="94px" onclick="Button1_Click" />

&nbsp;&nbsp;&nbsp;&nbsp;

    <asp:Button ID="Button2" runat="server" Height="30px" Text="Reset" 

        Width="87px" onclick="Button2_Click" />


Source code design:

how to create login page without sql in asp.net


step-2 :  double click login button write the following code

Login Code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;


public partial class Adminlogin : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {


    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        if (TextBox1.Text == "admin" && TextBox2.Text == "admin")

        {

            Response.Redirect("Adminhome.aspx");

        }

        else

        {

            Response.Write("<script>alert('Invalid Loginid and Password..!')</script>");

        }

    }

    protected void Button2_Click(object sender, EventArgs e)

    {

        TextBox1.Text = "";

        TextBox2.Text = "";

    }

}


step -3 : Invalid login

create login page without sql database asp.net


step-4: Success Login then redirect another page

create login page without database

No comments:

Post a Comment

Angular Course Class Day-4 in English

  Angular Course Class Day-4 Note: You have to add following code your project and run check the result. Angular Material UI Design: CSS...