JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
about 2 months ago1 views
👨‍💻Programming
Of course. 2 hours left and now we suddenly want discipline. Incredible timing. Let’s make it count. ⏱️

You just follow this step-by-step blindly and you’ll be fine.

⸻

🟢 FULL COMMAND FLOW (Start → Run → Create Page)

🔹 STEP 1 — Go to Desktop (or any folder)

cd Desktop


⸻

🔹 STEP 2 — Create Razor Project

dotnet new webapp -o daksh

⚠️ Remember:
	•	NOT razor
	•	Correct = webapp

⸻

🔹 STEP 3 — Enter Project Folder

cd daksh


⸻

🔹 STEP 4 — Open in VS Code

code .


⸻

🔹 STEP 5 — Run Project

dotnet watch run

Browser will open automatically
URL like:

https://localhost:xxxx


⸻

🟢 STEP 6 — Create New Page (IMPORTANT)

Go to:

Pages folder

Create 2 files:

Register.cshtml
Register.cshtml.cs


⸻

🟢 STEP 7 — Basic Working Code

🔹 Register.cshtml

@page
@model RegisterModel

<h2>Simple Form</h2>

<form method="post">
    Name:
    <input type="text" name="Name" value="@Model.Name" />
    <br /><br />

    Age:
    <input type="text" name="Age" value="@Model.Age" />
    <br /><br />

    <button type="submit">Submit</button>
</form>

@if (Model.Message != null)
{
    <p>@Model.Message</p>
}


⸻

🔹 Register.cshtml.cs

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

public class RegisterModel : PageModel
{
    [BindProperty]
    public string Name { get; set; }

    [BindProperty]
    public string Age { get; set; }

    public string Message { get; set; }

    public void OnPost()
    {
        Message = "Hello " + Name + ", Age: " + Age;
    }
}


⸻

🟢 STEP 8 — Open Your Page

In browser go to:

https://localhost:xxxx/Register

👉 VERY IMPORTANT:
You must manually type /Register

⸻

🚨 COMMON ERRORS (Don’t Be That Guy Again)

❌ Running inside wrong folder

Fix:

cd daksh


⸻

❌ Writing commands like @page in terminal

Please don’t embarrass yourself.

⸻

❌ “Project file not found”

Means you are not in project folder.

⸻

🔥 MINIMUM YOU MUST REMEMBER

If everything fails in exam:
	1.	dotnet new webapp -o name
	2.	Create .cshtml + .cshtml.cs
	3.	Use @page
	4.	Use [BindProperty]
	5.	Use OnPost()

That alone gets marks.

⸻

You don’t need perfection.
You need one working page.

Now go execute this instead of staring at it like philosophy.
← Back to timeline