+ Request ID: @Model.RequestId
+
+ Swapping to the Development environment displays detailed information about the error that occurred. +
++ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +
diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Error.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Error.cshtml.cs new file mode 100644 index 000000000000..f940eb629ffc --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Error.cshtml.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Diagnostics; + +namespace ConfigSample.Pages; +[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] +[IgnoreAntiforgeryToken] +public class ErrorModel : PageModel +{ + public string? RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + private readonly ILoggerLearn about building Web apps with ASP.NET Core.
+This content is never used. The preceding directives are required in Razor Pages.
\ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Index2.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Index2.cshtml.cs new file mode 100644 index 000000000000..d101a37c6a3f --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Index2.cshtml.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; +using System.Linq; + +namespace ConfigSample.Pages +{ + #region snippet + public class Index2Model : PageModel + { + private IConfigurationRoot ConfigRoot; + + public Index2Model(IConfiguration configRoot) + { + ConfigRoot = (IConfigurationRoot)configRoot; + } + + public ContentResult OnGet() + { + string str = ""; + foreach (var provider in ConfigRoot.Providers.ToList()) + { + str += provider.ToString() + "\n"; + } + + return Content(str); + } + } + #endregion +} diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml new file mode 100644 index 000000000000..46ba96612ec3 --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml @@ -0,0 +1,8 @@ +@page +@model PrivacyModel +@{ + ViewData["Title"] = "Privacy Policy"; +} +Use this page to detail your site's privacy policy.
diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml.cs new file mode 100644 index 000000000000..edbd2f77930b --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Privacy.cshtml.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ConfigSample.Pages; +public class PrivacyModel : PageModel +{ + private readonly ILoggerThis content is never used. The preceding directives are required in Razor Pages.
\ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test.cshtml.cs new file mode 100644 index 000000000000..363e79d7ceff --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test.cshtml.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; + +namespace ConfigSample +{ +//This content is never used. The preceding directives are required in Razor Pages.
+ +@* + Run the following from the command line to test the command line provider: + +dotnet run MyKey="My key from command line" Position:Title=Cmd_Editor Position:Name=Cmd_Rick +*@ \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test2.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test2.cshtml.cs new file mode 100644 index 000000000000..12b39215f6ca --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test2.cshtml.cs @@ -0,0 +1,25 @@ +using ConfigSample.Options; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Options; + +namespace ConfigSample.Pages +{ +//This content is never used. The preceding directives are required in Razor Pages.
+ +@* + Run the following from the command line to test the command line provider: + +dotnet run MyKey="My key from command line" Position:Title=Cmd_Editor Position:Name=Cmd_Rick +*@ \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test21.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test21.cshtml.cs new file mode 100644 index 000000000000..2c1d6ec4b001 --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test21.cshtml.cs @@ -0,0 +1,29 @@ +using ConfigSample.Options; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; + +namespace ConfigSample.Pages +{ +//This content is never used. The preceding directives are required in Razor Pages.
+ +@* + Run the following from the command line to test the command line provider: + +dotnet run MyKey="My key from command line" Position:Title=Cmd_Editor Position:Name=Cmd_Rick +*@ \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test22.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test22.cshtml.cs new file mode 100644 index 000000000000..d0648bf70605 --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test22.cshtml.cs @@ -0,0 +1,27 @@ +using ConfigSample.Options; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ConfigSample.Pages +{ +//This content is never used. The preceding directives are required in Razor Pages.
+ +@* + Run the following from the command line to test the command line provider: + +dotnet run MyKey="My key from command line" Position:Title=Cmd_Editor Position:Name=Cmd_Rick +*@ \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test25.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test25.cshtml.cs new file mode 100644 index 000000000000..0ac69da7819b --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test25.cshtml.cs @@ -0,0 +1,29 @@ +using ConfigSample.Options; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Options; + +namespace ConfigSample.Pages +{ + public class Test25Model : PageModel + { + private readonly PositionOptions _options; + private readonly ColorOptions _color_options; + + + public Test25Model(IOptionsThis content is never used. The preceding directives are required in Razor Pages.
+ +@* + Run the following from the command line to test the command line provider: + +dotnet run MyKey="My key from command line" Position:Title=Cmd_Editor Position:Name=Cmd_Rick +*@ \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test26.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test26.cshtml.cs new file mode 100644 index 000000000000..8cdd1e16f844 --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test26.cshtml.cs @@ -0,0 +1,33 @@ +using ConfigSample.Options; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.DependencyInjection.ConfigSample.Options; +using Microsoft.Extensions.Options; + +namespace ConfigSample.Pages +{ + public class Test26Model : PageModel + { + private readonly PositionOptions _options; + private readonly ColorOptions _color_options; + private readonly IMyDependency _myDependency; + + public Test26Model(IOptionsThis content is never used. The preceding directives are required in Razor Pages.
+ +Test with the following: + +dotnet run -k1=value1 -k2 value2 --alt3=value2 /alt4=value3 --alt5 value5 /alt6 value6 +dotnet run -k1 value1 -k2 value2 --alt3=value2 /alt4=value3 --alt5 value5 /alt6 value6 \ No newline at end of file diff --git a/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test3.cshtml.cs b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test3.cshtml.cs new file mode 100644 index 000000000000..db962bc239b4 --- /dev/null +++ b/aspnetcore/fundamentals/configuration/index/samples/8.x/ConfigSample/Pages/Test3.cshtml.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; + +namespace ConfigSample +{ +//