Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.32 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.32 KB

Solid.Extensions.System.Web License solidsoftworks MyGet Build Status

Solid.Extensions.System.Web is a library for patching HttpContext.Current to be more async friendly. This library is built for .Net Framework 4.6.1 and above.

Disclaimer

We do not recommended using this library in any new applications. You should always try to have your stack be fully async instead of using Task.Run or any other variation of that within sync methods.

If you are, however, up against the wall and have a sync stack already and need to use async methods, you can try this library out and see if it works for you.

Requirements

This is written for ASP.Net applications. This is not for AspNetCore applications.

How to use

Installation

Just reference the library. When the ASP.Net application starts, it will patch HttpContext.Current for you.

Usage

public string GetString()
{
    HttpContext.Items["Hello"] = "World";
    return HttpContext.Current.Run(() => GetStringAsync());
}

private async Task<string> GetStringAsync()
{
    return $"Hello {HttpContext.Current.Items["Hello"]}";
}