We known that, when we click a submit button on web page then all content of web page post to server. But user want only user name and password post to the server. it is only done by AJAX (Asynchronous JavaScript and XML). In this article we create a login web page using AJAX that check the value of login form on the database server.
There are various steps to create login web page through Ajax:
Step first, Go Visual studio >> File >> Web application.
Step second, Design web form with ScriptManager and Update panel:
Step third Create Table in Sql sever 2008:
Write these code:Imports System.Data.SqlClientImports System.IO Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim str As String = "Data Source=MCNDESKTOP14;Initial Catalog=studentinfo; uid=sa;pwd=wintellect" Dim con As SqlConnection con = New SqlConnection(str) con.Open() str = "Select * from login where name='" & TextBox1.Text & "' and Password1 ='" & TextBox2.Text & "';" Dim com As New SqlCommand(str, con) Dim rd As SqlDataReader = com.ExecuteReader() If rd.Read() Then Label1.Text = "Vaild user and password" Else Label1.Text = "inVaild user and password" End If End Sub End Class
Output:
How to Create Asynchronous Login Form in ADO.NET
How to cretae Button Column in VB.NET