Exams Lectures
Exams Lectures
using Microsoft.EntityFrameworkCore;
using LoginSystemApp.Models;
builder.Configuration.GetConnectionString("Default
Connection"),
new MySqlServerVersion(new Version(8, 0,
31)) // Replace with your MySQL version
));
app.UseStaticFiles();
app.UseRouting();
app.MapRazorPages();
Create the User Model:
namespace LoginSystemApp.Models;
using LoginSystemApp.Data;
using LoginSystemApp.Models;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Collections.Generic;
using System.Linq;
@page "{username}"
@model WelcomeModel
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h2>Welcome, @Model.Username!</h2>
<p>This is your user account page.</p>
</body>
</html>
Welcome Page Logic (Pages/Welcome.cshtml.cs):
using Microsoft.AspNetCore.Mvc.RazorPages;
• dotnet run
• in terminal
• Navigate to http://localhost:5000/Login
• Admin: Username: admin, Password: adminpassword
• User: Username: user1, Password: userpassword