<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>login page</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<form id="form1" runat="server">
<div class="login-container">
<h2>Login</h2>
<div class="input-group">
<label for="txtUsername">Username:</label>
<asp:TextBox ID="txtUsername" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="input-group">
<label for="txtPassword">Password:</label>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" CssClass="form-control"></asp:TextBox>
</div>
<div class="input-group">
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" CssClass="btn
btn-primary" />
</div>
</div>
</form>
</body>
</html>
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim username As String = txtUsername.Text
Dim password As String = txtPassword.Text
' Validate user
credentials (Replace this with your authentication logic)
If ValidateUser(username,
password) Then
' Authentication
successful, redirect to a secure page
'FormsAuthentication.RedirectFromLoginPage(username,
False)
Response.Write("welcome")
Else
' Authentication failed,
display an error message
Response.Write("Invalid username
or password")
End If
End Sub
Private Function ValidateUser(username As String, password As String) As Boolean
' Add your
authentication logic here
' For simplicity, we are
using a hardcoded username and password
Return username.ToLower() = "admin" AndAlso password = "password"
End Function
End Class