Dismiss Notice

Register now to be one of the first members of this SharePoint Community! Click here it just takes seconds!

Dismiss Notice
Welcome Guest from Country Flag

.NET Framework 4.7.1 ASP.NET and Configuration features

Discussion in 'Official Microsoft News' started by Preeti Krishna - MSFT, Sep 14, 2017.

Thread Status:
Not open for further replies.
  1. Preeti Krishna - MSFT

    Preeti Krishna - MSFT Guest

    Blog Posts:
    0
    0
    0
    0
    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 Developer Pack is covered in the Welcome to the .NET Framework 4.7.1 Early Access blog post.

    Configuration builders

    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. 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 - possibly drawing new data from new sources that are not static files.
    To use the Configuration Builders feature, developers simply need to declare builders in config, then apply them to configuration sections with the ConfigBuilders tag.
    To implement custom Configuration Builder, developers can inherit from the System.Configuration.ConfigurationBuilder base class.

    Here are some code samples that will enable you to declare, use and apply configuration builders.

    ASP.NET Execution Step Feature

    ASP.NET processes requests in its predefined pipeline which includes 23 events. ASP.NET executes each event handler as an execution step. With this new ExecutionStepInvoker feature, developers will be able to run this execution step inside their code.
    Today ASP.NET can’t 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.).

    We have added a new API to enable this: HttpApplication.OnExecuteStep(Action<HttpContextBase, Action> callback)

    Check the following sample to leverage this new feature.

    ASP.NET HttpCookie parsing


    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 reads as follows: static bool HttpCookie.TryParse(string s, out HttpCookie result)
    The following sample illustrates the usage of this new API.

    ASP.NET Forms Authentication Credentials


    ASP.NET has always allowed developers to store user credentials with hashed passwords in configuration files. Previously, the available hash algorithms for this feature were MD5 or SHA1. Now new secure SHA-2 hash options like SHA256, SHA384 and SHA512 are added in .NET Framework 4.7.1. SHA1 is still the default to preserve compatibility.

    Refer to the following sample to leverage this new feature.

    SHA-2 support for Message.HashAlgorithm


    In previous versions, if a user code specified a System.Messaging HashAlgorithm value, it was limited to MD5 and Sha1. With .NET Framework 4.7.1, there is support for HashAlgorithm values for Sha256, Sha384, and Sha512 added to System.Messaging Message.HashAlgorithm. The actual usage of these values is in MSMQ as MSMQ makes the “default” decision and these values are simply passed down to MSMQ. System.Messaging does not do any hashing with these values. Following snippet illustrates how you can enable hashing on a queue and create a message with these new values.

    Closing


    Try out these new features in .NET Framework 4.7.1 Early Access build shared and please provide your feedback by reporting an issue at the .NET Framework Early Access GitHub repository. Stay tuned for further feature overviews in .NET Framework 4.7.1.

    Continue reading...
     
Thread Status:
Not open for further replies.

Share This Page

LiveZilla Live Chat Software