how to compress the output send by an asp.net mvc application??
how to compress the output send by an asp.net mvc application??
For .NET Core 2.1 there is a new package that can be used ( Microsoft.AspNetCore.ResponseCompression )
Simple sample to get going, after installing the package:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddResponseCompression();
services.AddResponseCompression(options =>
{
options.Providers.Add<GzipCompressionProvider>();
options.EnableForHttps = true;
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseResponseCompression();
}
}
You can read more about it here: https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-2.1&tabs=aspnetcore2x