locked
How can I add ETag in asp.net core 5? RRS feed

  • Question

  • User1052024640 posted

    I have an existed project made by asp.net core 5.

    Now I need to add ETag(https://en.wikipedia.org/wiki/HTTP_ETag) to it for SEO(ETag works for sitemap and page).

    How can I achieve this? Thank you.

    Wednesday, December 23, 2020 10:11 AM

Answers

  • User1052024640 posted

    I found an easy way soon:

    Install a Nuget package Marvin.Cache.Headers

    Add this in ConfigureServices:

    services.AddHttpCacheHeaders();

    And add this in Configure:

    app.UseHttpCacheHeaders();

    And then the ETag will work automatically.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 23, 2020 11:32 AM