{"id":14476,"date":"2017-09-13T17:23:49","date_gmt":"2017-09-14T00:23:49","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/dotnet\/?p=14476"},"modified":"2021-09-29T16:39:58","modified_gmt":"2021-09-29T23:39:58","slug":"net-framework-4-7-1-asp-net-and-configuration-features","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/net-framework-4-7-1-asp-net-and-configuration-features\/","title":{"rendered":".NET Framework 4.7.1 ASP.NET and Configuration features"},"content":{"rendered":"<p>This post describes the new ASP.NET, Configuration and System.Messaging features and improvements in the .NET Framework 4.7.1. More information on the build these features are available in and how to get the\u00a0Developer Pack\u00a0is covered in the\u00a0<a href=\"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2017\/08\/07\/welcome-to-the-net-framework-4-7-1-early-access\/\">Welcome to the .NET Framework 4.7.1 Early Access blog post<\/a>.<\/p>\n<h2>Configuration builders<\/h2>\n<div>\n<div>Configuration builders allow developers to inject and build configuration for applications at runtime, allowing configuration data to be pulled from sources beyond the traditional .config file.\u00a0 In previous versions of the .NET Framework, configuration has been static. Applications only draw configuration data from a limited chain of .config files. With Configuration Builders, applications can apply a custom-defined set of builders to any section of config. These builders are free to modify the configuration data contained in the given config section, or build it entirely from scratch &#8211; possibly drawing new data from new sources that are not static files.<\/div>\n<div><\/div>\n<div><\/div>\n<div>To use the Configuration Builders feature, developers simply need to declare builders in config, then apply them to configuration sections with the ConfigBuilders tag.<\/div>\n<div>To implement custom Configuration Builder, developers can inherit from the System.Configuration.ConfigurationBuilder base class.<\/div>\n<div><\/div>\n<\/div>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/93866f8060951cf6cb6f5e4b1f05a54f.js\"><\/script><\/p>\n<p>Here are some code samples that will enable you to declare, use and apply configuration builders.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/55335d117f9f5f992d7c07796fe18bcf.js\"><\/script><\/p>\n<h2><span> <\/span>ASP.NET Execution Step Feature<\/h2>\n<div>ASP.NET processes requests in its predefined pipeline which includes <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb470252.aspx\">23 events<\/a>. ASP.NET executes each event handler as an execution step. With this new <span>ExecutionStepInvoker\u00a0<\/span>feature, developers will be able to run this execution step inside their code.<\/div>\n<div><\/div>\n<div>Today ASP.NET can\u2019t flow the execution context due to switching between native threads and managed threads. ASP.NET selectively flows only the HttpContext which may not be sufficient for ambient context scenarios. With this feature we enable modules to restore ambient data. The ExecutionStepInvoker is intended for libraries that care about the execution flow of the application (tracing, profiling, diagnostics, transactions, etc.).<\/div>\n<div>\n<p>We have added a new API to enable this: HttpApplication.OnExecuteStep(Action&lt;HttpContextBase,\u00a0Action&gt;\u00a0callback)<\/p>\n<\/div>\n<div>Check the following sample to leverage this new feature.\n<\/div>\n<div>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/6c957f55dc2a0da950cf9fe701900a96.js\"><\/script><\/p>\n<h2><span>ASP.NET HttpCookie parsing<\/span><\/h2>\n<p>It can be challenging parsing HttpCookie Set-Cookie\/Cookie headers to read and write cookie properties from HTTP Headers. Now, we have provided support for a new API that allows for a standardized way to create an HttpCookie object from a string and accurately capture properties of the cookie like expiration date, path, the secure indicator. Furthermore, it assigns cookie value(s) appropriately. This new ASP.NET API for parsing HttpCookie from Set-Cookie\/Cookie headers\u00a0reads as follows: static bool HttpCookie.TryParse(string s, out HttpCookie result)\nThe following sample illustrates the usage of this new API.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/08fe887151364ef95ea7ffdec47d60e1.js\"><\/script><\/p>\n<h2>ASP.NET Forms Authentication Credentials<\/h2>\n<p>ASP.NET has always allowed developers to store user credentials with hashed passwords in configuration files.\u00a0Previously, the available hash algorithms for this feature were MD5 or SHA1. Now new secure <a href=\"https:\/\/en.wikipedia.org\/wiki\/SHA-2\">SHA-2<\/a> hash options like SHA256, SHA384 and SHA512 are\u00a0added in .NET Framework 4.7.1. SHA1 is still the default to preserve compatibility.<\/p>\n<p>Refer to the following sample to leverage this new feature.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/b9ff553ae4ee238615fd90affd2554eb.js\"><\/script><\/p>\n<h2>SHA-2 support for Message.HashAlgorithm<\/h2>\n<p>In previous versions, if a user code specified a System.Messaging HashAlgorithm value, it was\u00a0limited to MD5 and Sha1. With .NET Framework 4.7.1, there is support for\u00a0HashAlgorithm values for Sha256, Sha384, and Sha512 added to System.Messaging Message.HashAlgorithm. The actual usage of these values is in MSMQ\u00a0as\u00a0MSMQ makes the \u201cdefault\u201d decision and these values are simply passed down to MSMQ. System.Messaging does not do any hashing with these values. \u00a0Following snippet illustrates how you can enable hashing on a queue and create a message with these new values.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/preetikr\/acb5f6553f87ee29e7d76a503ac7d700.js\"><\/script><\/p>\n<h2>Closing<\/h2>\n<p>Try out these new features in .NET Framework 4.7.1 Early Access build shared and please provide your feedback by\u00a0<a href=\"https:\/\/github.com\/Microsoft\/dotnet-framework-early-access\/issues\/new\">reporting an issue at the .NET Framework Early Access GitHub repository<\/a>. Stay tuned for further feature overviews\u00a0in .NET Framework 4.7.1.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This post describes the new ASP.NET, Configuration and System.Messaging features and improvements in the .NET Framework 4.7.1. More information on the build these features are available in and how to get the\u00a0Developer Pack\u00a0is covered in the\u00a0Welcome to the .NET Framework 4.7.1 Early Access blog post. Configuration builders Configuration builders allow developers to inject and build [&hellip;]<\/p>\n","protected":false},"author":364,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[],"class_list":["post-14476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"acf":[],"blog_post_summary":"<p>This post describes the new ASP.NET, Configuration and System.Messaging features and improvements in the .NET Framework 4.7.1. More information on the build these features are available in and how to get the\u00a0Developer Pack\u00a0is covered in the\u00a0Welcome to the .NET Framework 4.7.1 Early Access blog post. Configuration builders Configuration builders allow developers to inject and build [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/14476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/364"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=14476"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/14476\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=14476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=14476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=14476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}