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 | -------------------------------------------------------------------------------- /samples/Samples.Authorization/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace AuthorizationSample.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 ILoggerLogged in? @(HttpContext.User.Identity?.IsAuthenticated == true ? "Yes" : "No")
15 | @if (HttpContext.User.Identity?.IsAuthenticated == true) 16 | { 17 |Current identity claims:
18 |6 | Cats 7 |
8 |9 | Dogs 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/Samples.MultipleSchemas/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace MultipleSchema.Pages; 4 | 5 | public class IndexModel : PageModel 6 | { 7 | private readonly ILoggerHello there
7 | -------------------------------------------------------------------------------- /samples/Samples.Net48/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace GraphQL.Server.Samples.Net48.Pages; 4 | 5 | public class IndexModel : PageModel 6 | { 7 | [Route("/")] 8 | public ActionResult OnGet() 9 | { 10 | return Redirect("/ui/graphql"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/Samples.Net48/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using GraphQL.Server.Samples.Net48 2 | @namespace GraphQL.Server.Samples.Net48.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /samples/Samples.Net48/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | 3 | namespace GraphQL.Server.Samples.Net48; 4 | 5 | public class Program 6 | { 7 | public static void Main(string[] args) 8 | { 9 | CreateWebHostBuilder(args).Build().Run(); 10 | } 11 | 12 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 13 | WebHost.CreateDefaultBuilder(args) 14 | .UseStartup19 |
21 | 22 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /samples/Samples.Upload/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace GraphQL.Server.Samples.Upload.Pages 4 | { 5 | public class IndexModel : PageModel 6 | { 7 | public void OnGet() 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/Samples.Upload/Program.cs: -------------------------------------------------------------------------------- 1 | using GraphQL; 2 | using Samples.Upload; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | builder.Services.AddRazorPages(); 7 | builder.Services.AddGraphQL(b => b 8 | .AddAutoSchema 20 |