13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /0-Start/BigBadBlog.Web/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BigBadBlog.Web.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@Html.Raw(Markdig.Markdown.ToHtml(post.Content, Model.MarkdownPipeline))
19 |@Html.Raw(Markdig.Markdown.ToHtml(Model.Post.Content, Model.MarkdownPipeline))
10 | -------------------------------------------------------------------------------- /0-Start/BigBadBlog.Web/Pages/Post.cshtml.cs: -------------------------------------------------------------------------------- 1 | using BigBadBlog.Web.Data; 2 | using Markdig; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace BigBadBlog.Web.Pages; 8 | 9 | public class PostModel : PageModel 10 | { 11 | private readonly IPostRepository _postRepository; 12 | public readonly MarkdownPipeline MarkdownPipeline; 13 | 14 | public PostModel(IPostRepository postRepository, IWebHostEnvironment host) 15 | { 16 | _postRepository = postRepository; 17 | 18 | MarkdownPipeline = new MarkdownPipelineBuilder() 19 | .UseYamlFrontMatter() 20 | .Build(); 21 | 22 | } 23 | 24 | public (PostMetadata Metadata, string Content) Post { get; private set; } 25 | 26 | public async TaskUse this page to detail your site's privacy policy.
9 | -------------------------------------------------------------------------------- /0-Start/BigBadBlog.Web/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace BigBadBlog.Web.Pages; 5 | 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger
13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /1-IntroducingAspire/BigBadBlog.Web/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BigBadBlog.Web.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@Html.Raw(Markdig.Markdown.ToHtml(post.Content, Model.MarkdownPipeline))
19 |@Html.Raw(Markdig.Markdown.ToHtml(Model.Post.Content, Model.MarkdownPipeline))
10 | -------------------------------------------------------------------------------- /1-IntroducingAspire/BigBadBlog.Web/Pages/Post.cshtml.cs: -------------------------------------------------------------------------------- 1 | using BigBadBlog.Web.Data; 2 | using Markdig; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | using Microsoft.AspNetCore.OutputCaching; 6 | using Microsoft.Extensions.Hosting; 7 | 8 | namespace BigBadBlog.Web.Pages; 9 | 10 | [OutputCache(PolicyName = "Post")] 11 | public class PostModel : PageModel 12 | { 13 | private readonly IPostRepository _postRepository; 14 | public readonly MarkdownPipeline MarkdownPipeline; 15 | 16 | public PostModel(IPostRepository postRepository, IWebHostEnvironment host) 17 | { 18 | _postRepository = postRepository; 19 | 20 | MarkdownPipeline = new MarkdownPipelineBuilder() 21 | .UseYamlFrontMatter() 22 | .Build(); 23 | 24 | } 25 | 26 | public (PostMetadata Metadata, string Content) Post { get; private set; } 27 | 28 | public async TaskUse this page to detail your site's privacy policy.
9 | -------------------------------------------------------------------------------- /1-IntroducingAspire/BigBadBlog.Web/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace BigBadBlog.Web.Pages; 5 | 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger
13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /2-DatabaseMigrationAndEF/BigBadBlog.Web/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BigBadBlog.Web.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@Html.Raw(Markdig.Markdown.ToHtml(post.Content, Model.MarkdownPipeline))
19 |@Html.Raw(Markdig.Markdown.ToHtml(Model.Post.Content, Model.MarkdownPipeline))
10 | -------------------------------------------------------------------------------- /2-DatabaseMigrationAndEF/BigBadBlog.Web/Pages/Post.cshtml.cs: -------------------------------------------------------------------------------- 1 | using BigBadBlog.Common.Data; 2 | using BigBadBlog.Web.Data; 3 | using Markdig; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | using Microsoft.AspNetCore.OutputCaching; 7 | using Microsoft.Extensions.Hosting; 8 | 9 | namespace BigBadBlog.Web.Pages; 10 | 11 | [OutputCache(PolicyName = "Post")] 12 | public class PostModel : PageModel 13 | { 14 | private readonly IPostRepository _postRepository; 15 | public readonly MarkdownPipeline MarkdownPipeline; 16 | 17 | public PostModel(IPostRepository postRepository, IWebHostEnvironment host) 18 | { 19 | _postRepository = postRepository; 20 | 21 | MarkdownPipeline = new MarkdownPipelineBuilder() 22 | .UseYamlFrontMatter() 23 | .Build(); 24 | 25 | } 26 | 27 | public (PostMetadata Metadata, string Content) Post { get; private set; } 28 | 29 | public async TaskUse this page to detail your site's privacy policy.
9 | -------------------------------------------------------------------------------- /2-DatabaseMigrationAndEF/BigBadBlog.Web/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace BigBadBlog.Web.Pages; 5 | 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger
13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /3-MicroserviceAndMongoDB/BigBadBlog.Web/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BigBadBlog.Web.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@Html.Raw(Markdig.Markdown.ToHtml(post.Content, Model.MarkdownPipeline))
19 |@Html.Raw(Markdig.Markdown.ToHtml(Model.Post.Content, Model.MarkdownPipeline))
10 | -------------------------------------------------------------------------------- /3-MicroserviceAndMongoDB/BigBadBlog.Web/Pages/Post.cshtml.cs: -------------------------------------------------------------------------------- 1 | using BigBadBlog.Common.Data; 2 | using BigBadBlog.Web.Data; 3 | using Markdig; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | using Microsoft.AspNetCore.OutputCaching; 7 | using Microsoft.Extensions.Hosting; 8 | 9 | namespace BigBadBlog.Web.Pages; 10 | 11 | [OutputCache(PolicyName = "Post")] 12 | public class PostModel : PageModel 13 | { 14 | private readonly IPostRepository _postRepository; 15 | public readonly MarkdownPipeline MarkdownPipeline; 16 | 17 | public PostModel(IPostRepository postRepository, IWebHostEnvironment host) 18 | { 19 | _postRepository = postRepository; 20 | 21 | MarkdownPipeline = new MarkdownPipelineBuilder() 22 | .UseYamlFrontMatter() 23 | .Build(); 24 | 25 | } 26 | 27 | public (PostMetadata Metadata, string Content) Post { get; private set; } 28 | 29 | public async TaskUse this page to detail your site's privacy policy.
9 | -------------------------------------------------------------------------------- /3-MicroserviceAndMongoDB/BigBadBlog.Web/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace BigBadBlog.Web.Pages; 5 | 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger
13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /completed_application/BigBadBlog.Web/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace BigBadBlog.Web.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@Html.Raw(Markdig.Markdown.ToHtml(post.Content, Model.MarkdownPipeline))
19 |@Html.Raw(Markdig.Markdown.ToHtml(Model.Post.Content, Model.MarkdownPipeline))
10 | -------------------------------------------------------------------------------- /completed_application/BigBadBlog.Web/Pages/Post.cshtml.cs: -------------------------------------------------------------------------------- 1 | using BigBadBlog.Common.Data; 2 | using BigBadBlog.Web.Data; 3 | using Markdig; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.RazorPages; 6 | using Microsoft.AspNetCore.OutputCaching; 7 | using Microsoft.Extensions.Hosting; 8 | 9 | namespace BigBadBlog.Web.Pages; 10 | 11 | [OutputCache(PolicyName = "Post")] 12 | public class PostModel : PageModel 13 | { 14 | private readonly IPostRepository _postRepository; 15 | public readonly MarkdownPipeline MarkdownPipeline; 16 | 17 | public PostModel(IPostRepository postRepository, IWebHostEnvironment host) 18 | { 19 | _postRepository = postRepository; 20 | 21 | MarkdownPipeline = new MarkdownPipelineBuilder() 22 | .UseYamlFrontMatter() 23 | .Build(); 24 | 25 | } 26 | 27 | public (PostMetadata Metadata, string Content) Post { get; private set; } 28 | 29 | public async TaskUse this page to detail your site's privacy policy.
9 | -------------------------------------------------------------------------------- /completed_application/BigBadBlog.Web/Pages/Privacy.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | 4 | namespace BigBadBlog.Web.Pages; 5 | 6 | public class PrivacyModel : PageModel 7 | { 8 | private readonly ILogger