public XRobotsTagMiddleware(RequestDelegate next, XRobotsTagHeaderValue headerValue) { _next = next; Options = headerValue ?? throw new ArgumentNullException(nameof(headerValue)); _headerValue = Options.ToString(); }
/// <summary> /// Adds the X-Robots-Tag header to all responses. /// </summary> /// <param name="app"></param> /// <param name="headerValue"></param> public static void UseXRobotsTag(this IApplicationBuilder app, XRobotsTagHeaderValue headerValue) { app.UseMiddleware <XRobotsTagMiddleware>(headerValue); }