ASP.NET Tutorial - Hello World in 10 minutes

Edit your code

Open Pages/Index.cshtml in any text editor and replace all of the code with the following, then save the file.

Index.cshtml
@page
@model IndexModel
@{
    ViewData["Title"] = "Home page";
}

<div class="text-center">
    <h1>Hello, world!</h1>
    <p>The time on the server is @DateTime.Now</p>
</div>

Rerun your app

Press CTRL+C on your command prompt to end the previous dotnet run command that is running the site locally.

Press CTRL+C on your terminal to end the previous dotnet run command that is running the site locally by pressing CTRL+C on your terminal.

Then, run the following command to re-launch the site:

Command prompt
dotnet run

Refresh the browser to see the change. You should see an output similar to the following:

When the page is refreshed, the new content you just added will appear on the page.

Continue