Skip to content

Commit 478d5c5

Browse files
committed
2 parents a95ea2e + 60dfd68 commit 478d5c5

File tree

72 files changed

+53787
-19563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+53787
-19563
lines changed
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
</PropertyGroup>
6-
7-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
</Project>
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
@page
2-
@model ErrorModel
3-
@{
4-
ViewData["Title"] = "Error";
5-
}
6-
7-
<h1 class="text-danger">Error.</h1>
8-
<h2 class="text-danger">An error occurred while processing your request.</h2>
9-
10-
@if (Model.ShowRequestId)
11-
{
12-
<p>
13-
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14-
</p>
15-
}
16-
17-
<h3>Development Mode</h3>
18-
<p>
19-
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20-
</p>
21-
<p>
22-
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23-
It can result in displaying sensitive information from exceptions to end users.
24-
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25-
and restarting the app.
26-
</p>
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore.Mvc;
7-
using Microsoft.AspNetCore.Mvc.RazorPages;
8-
using Microsoft.Extensions.Logging;
9-
10-
namespace FirstApp.Pages
11-
{
12-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13-
[IgnoreAntiforgeryToken]
14-
public class ErrorModel : PageModel
15-
{
16-
public string RequestId { get; set; }
17-
18-
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
19-
20-
private readonly ILogger<ErrorModel> _logger;
21-
22-
public ErrorModel(ILogger<ErrorModel> logger)
23-
{
24-
_logger = logger;
25-
}
26-
27-
public void OnGet()
28-
{
29-
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
30-
}
31-
}
32-
}
1+
using System.Diagnostics;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.AspNetCore.Mvc.RazorPages;
4+
5+
namespace FirstApp.Pages;
6+
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
@page
2-
@model IndexModel
3-
@{
4-
ViewData["Title"] = "Home page";
5-
}
6-
7-
<div class="text-center">
8-
<h1 class="display-4" style="color: @Model.FontColor">Welcome <b>Visual Studio!</b></h1>
9-
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10-
</div>
11-
12-
<p>
13-
The current timestamp in UTC is: @DateTime.UtcNow
14-
</p>
15-
16-
17-
@section Scripts {
18-
<!-- Hi Visual Studio -->
19-
}
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Welcome</h1>
9+
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10+
</div>
Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,19 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore.Mvc;
7-
using Microsoft.AspNetCore.Mvc.RazorPages;
8-
using Microsoft.Extensions.Logging;
9-
10-
namespace FirstApp.Pages
11-
{
12-
public class IndexModel : PageModel
13-
{
14-
private readonly ILogger _logger;
15-
private readonly Stopwatch _Timer = Stopwatch.StartNew();
16-
private readonly Stopwatch _Timer2;
17-
private readonly Stopwatch _Timer3;
18-
19-
public IndexModel(ILoggerFactory loggerFactory)
20-
{
21-
_Timer2 = Stopwatch.StartNew();
22-
_logger = loggerFactory.CreateLogger("FooMagoo");
23-
_logger.LogInformation($"Timer is at: {_Timer.ElapsedTicks} ticks");
24-
_Timer3 = Stopwatch.StartNew();
25-
}
26-
27-
public string FontColor { get { return DateTime.Now.Second % 2 == 0 ? "blue" : "red"; }}
28-
29-
public void OnGet()
30-
{
31-
32-
_logger.LogInformation("Output the Index page");
33-
_logger.LogInformation($"Page rendered in: {_Timer.ElapsedTicks} ticks");
34-
_logger.LogInformation($"Timer2 in: {_Timer2.ElapsedTicks} ticks");
35-
_logger.LogInformation($"Timer3 in: {_Timer3.ElapsedTicks} ticks");
36-
37-
}
38-
}
39-
}
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace FirstApp.Pages;
5+
6+
public class IndexModel : PageModel
7+
{
8+
private readonly ILogger<IndexModel> _logger;
9+
10+
public IndexModel(ILogger<IndexModel> logger)
11+
{
12+
_logger = logger;
13+
}
14+
15+
public void OnGet()
16+
{
17+
18+
}
19+
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@page "/gdpr"
2-
@model PrivacyModel
3-
@{
4-
ViewData["Title"] = "Privacy Policy";
5-
}
6-
<h1>@ViewData["Title"]</h1>
7-
8-
<p>Use this page to detail your site's privacy policy.</p>
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>
Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Mvc;
6-
using Microsoft.AspNetCore.Mvc.RazorPages;
7-
using Microsoft.Extensions.Logging;
8-
9-
namespace FirstApp.Pages
10-
{
11-
public class PrivacyModel : PageModel
12-
{
13-
private readonly ILogger<PrivacyModel> _logger;
14-
15-
public PrivacyModel(ILogger<PrivacyModel> logger)
16-
{
17-
_logger = logger;
18-
}
19-
20-
public void OnGet()
21-
{
22-
}
23-
}
24-
}
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace FirstApp.Pages;
5+
6+
public class PrivacyModel : PageModel
7+
{
8+
private readonly ILogger<PrivacyModel> _logger;
9+
10+
public PrivacyModel(ILogger<PrivacyModel> logger)
11+
{
12+
_logger = logger;
13+
}
14+
15+
public void OnGet()
16+
{
17+
}
18+
}
19+
Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>@ViewData["Title"] - FirstApp</title>
7-
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8-
<link rel="stylesheet" href="~/css/site.css" />
9-
</head>
10-
<body>
11-
<header>
12-
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
13-
<div class="container">
14-
<a class="navbar-brand" asp-area="" asp-page="/Index">FirstApp</a>
15-
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
16-
aria-expanded="false" aria-label="Toggle navigation">
17-
<span class="navbar-toggler-icon"></span>
18-
</button>
19-
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
20-
<ul class="navbar-nav flex-grow-1">
21-
<li class="nav-item">
22-
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
23-
</li>
24-
<li class="nav-item">
25-
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
26-
</li>
27-
</ul>
28-
</div>
29-
</div>
30-
</nav>
31-
</header>
32-
<div class="container">
33-
<main role="main" class="pb-3">
34-
@RenderBody()
35-
</main>
36-
</div>
37-
38-
<footer class="border-top footer text-muted">
39-
<div class="container">
40-
&copy; 2020 - FirstApp - <a asp-area="" asp-page="/Privacy">Privacy</a>
41-
</div>
42-
</footer>
43-
44-
<script src="~/lib/jquery/dist/jquery.min.js"></script>
45-
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
46-
<script src="~/js/site.js" asp-append-version="true"></script>
47-
48-
@await RenderSectionAsync("Scripts", required: false)
49-
</body>
50-
</html>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - FirstApp</title>
7+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8+
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
9+
<link rel="stylesheet" href="~/FirstApp.styles.css" asp-append-version="true" />
10+
</head>
11+
<body>
12+
<header>
13+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
14+
<div class="container">
15+
<a class="navbar-brand" asp-area="" asp-page="/Index">FirstApp</a>
16+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
17+
aria-expanded="false" aria-label="Toggle navigation">
18+
<span class="navbar-toggler-icon"></span>
19+
</button>
20+
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
21+
<ul class="navbar-nav flex-grow-1">
22+
<li class="nav-item">
23+
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
24+
</li>
25+
<li class="nav-item">
26+
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
27+
</li>
28+
</ul>
29+
</div>
30+
</div>
31+
</nav>
32+
</header>
33+
<div class="container">
34+
<main role="main" class="pb-3">
35+
@RenderBody()
36+
</main>
37+
</div>
38+
39+
<footer class="border-top footer text-muted">
40+
<div class="container">
41+
&copy; 2022 - FirstApp - <a asp-area="" asp-page="/Privacy">Privacy</a>
42+
</div>
43+
</footer>
44+
45+
<script src="~/lib/jquery/dist/jquery.min.js"></script>
46+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
47+
<script src="~/js/site.js" asp-append-version="true"></script>
48+
49+
@await RenderSectionAsync("Scripts", required: false)
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)