Skip to content

Commit e2b686a

Browse files
committed
initial commit
0 parents  commit e2b686a

Some content is hidden

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

58 files changed

+51934
-0
lines changed

Pages/Error.cshtml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +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>

Pages/Error.cshtml.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
9+
namespace aspnet.Pages
10+
{
11+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12+
public class ErrorModel : PageModel
13+
{
14+
public string RequestId { get; set; }
15+
16+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17+
18+
public void OnGet()
19+
{
20+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21+
}
22+
}
23+
}

Pages/Index.cshtml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +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">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>

Pages/Index.cshtml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
8+
namespace aspnet.Pages
9+
{
10+
public class IndexModel : PageModel
11+
{
12+
public void OnGet()
13+
{
14+
15+
}
16+
}
17+
}

Pages/Privacy.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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>

Pages/Privacy.cshtml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
8+
namespace aspnet.Pages
9+
{
10+
public class PrivacyModel : PageModel
11+
{
12+
public void OnGet()
13+
{
14+
}
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@using Microsoft.AspNetCore.Http.Features
2+
3+
@{
4+
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
5+
var showBanner = !consentFeature?.CanTrack ?? false;
6+
var cookieString = consentFeature?.CreateConsentCookie();
7+
}
8+
9+
@if (showBanner)
10+
{
11+
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
12+
Use this space to summarize your privacy and cookie use policy. <a asp-page="/Privacy">Learn More</a>.
13+
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
14+
<span aria-hidden="true">Accept</span>
15+
</button>
16+
</div>
17+
<script>
18+
(function () {
19+
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
20+
button.addEventListener("click", function (event) {
21+
document.cookie = button.dataset.cookieString;
22+
}, false);
23+
})();
24+
</script>
25+
}

Pages/Shared/_Layout.cshtml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - aspnet</title>
7+
8+
<environment include="Development">
9+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
10+
</environment>
11+
<environment exclude="Development">
12+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
13+
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
14+
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
15+
crossorigin="anonymous"
16+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"/>
17+
</environment>
18+
<link rel="stylesheet" href="~/css/site.css" />
19+
</head>
20+
<body>
21+
<header>
22+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
23+
<div class="container">
24+
<a class="navbar-brand" asp-area="" asp-page="/Index">aspnet</a>
25+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
26+
aria-expanded="false" aria-label="Toggle navigation">
27+
<span class="navbar-toggler-icon"></span>
28+
</button>
29+
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
30+
<ul class="navbar-nav flex-grow-1">
31+
<li class="nav-item">
32+
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
33+
</li>
34+
<li class="nav-item">
35+
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
36+
</li>
37+
</ul>
38+
</div>
39+
</div>
40+
</nav>
41+
</header>
42+
<div class="container">
43+
<partial name="_CookieConsentPartial" />
44+
<main role="main" class="pb-3">
45+
@RenderBody()
46+
</main>
47+
</div>
48+
49+
<footer class="border-top footer text-muted">
50+
<div class="container">
51+
&copy; 2020 - aspnet - <a asp-area="" asp-page="/Privacy">Privacy</a>
52+
</div>
53+
</footer>
54+
55+
<environment include="Development">
56+
<script src="~/lib/jquery/dist/jquery.js"></script>
57+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
58+
</environment>
59+
<environment exclude="Development">
60+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
61+
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
62+
asp-fallback-test="window.jQuery"
63+
crossorigin="anonymous"
64+
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
65+
</script>
66+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"
67+
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
68+
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
69+
crossorigin="anonymous"
70+
integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o">
71+
</script>
72+
</environment>
73+
<script src="~/js/site.js" asp-append-version="true"></script>
74+
75+
@RenderSection("Scripts", required: false)
76+
</body>
77+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<environment include="Development">
2+
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
3+
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
4+
</environment>
5+
<environment exclude="Development">
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"
7+
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
8+
asp-fallback-test="window.jQuery && window.jQuery.validator"
9+
crossorigin="anonymous"
10+
integrity="sha256-F6h55Qw6sweK+t7SiOJX+2bpSAa3b/fnlrVCJvmEj1A=">
11+
</script>
12+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"
13+
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
14+
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
15+
crossorigin="anonymous"
16+
integrity="sha256-9GycpJnliUjJDVDqP0UEu/bsm9U+3dnQUH8+3W10vkY=">
17+
</script>
18+
</environment>

Pages/_ViewImports.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@using aspnet
2+
@namespace aspnet.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

0 commit comments

Comments
 (0)