NoCacheApplicationBuilderExtensions Class

Extension methods to register NoCacheMiddleware.

public static class NoCacheApplicationBuilderExtensions

Methods

NameDescription
UseNoCache(IApplicationBuilder)Adds a middleware that sets a default non-cacheable Cache-Control response header when the response does not define one.

UseNoCache(IApplicationBuilder)

NoCacheApplicationBuilderExtensions.cs

Adds a middleware that sets a default non-cacheable Cache-Control response header when the response does not define one.

public static IApplicationBuilder UseNoCache(this IApplicationBuilder app)

Parameters

app IApplicationBuilder
The application builder.

Returns

IApplicationBuilder The application builder, to allow chaining.

Remarks

Register this after any component that serves cacheable content, such as UseStaticFiles. See NoCacheMiddleware for the caching implications of the default value.