Skip to content

Request CachePolicy isn't applied in HTTP request header #31320

Closed
@benZhai01

Description

@benZhai01

Steps:

  1. create a Console App(.net core 3.0)
  2. apply following code
static void Main(string[] args)
{
    var url = "https://docs.microsoft.com/en-us/dotnet/api/system.net.cache.requestcachelevel?view=netframework-4.8";
    var req = System.Net.HttpWebRequest.Create(url);
    req.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
    var res = req.GetResponse();
}
  1. run sample.

Actual Behavior

It's observerd that http request header doesn't include the cache setting.

image

Expected Behavior

Runing with the same code in Console App against .net framework, we can get following request header.
image

My Question

  1. Is it a bug or by design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Nethelp wanted[up-for-grabs] Good issue for external contributorstenet-compatibilityIncompatibility with previous versions or .NET Framework

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions