Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpWebRequest does not add referer header to redirects when AllowAutoRedirect is true #31225

Open
cubesnyc opened this issue Oct 19, 2019 · 3 comments
Labels
area-System.Net backlog-cleanup-candidate An inactive issue that has been marked for automated closure. documentation Documentation bug or enhancement, does not impact product or test code no-recent-activity
Milestone

Comments

@cubesnyc
Copy link

According to
https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.referer?view=netframework-4.8
"If the AllowAutoRedirect property is true, the Referer property is set automatically when the request is redirected to another site."

However, this behavior does not happen.

Quick reproducible code:

            var request = HttpWebRequest.CreateHttp( "https://httpstat.us/302" );
            request.AllowAutoRedirect = true;
            await request.GetResponseAsync();
@scalablecory scalablecory changed the title HttpClient does not add referer header to redirects when allowautoredirect is true HttpWebRequest does not add referer header to redirects when AllowAutoRedirect is true Oct 21, 2019
@davidsh
Copy link
Contributor

davidsh commented Oct 21, 2019

According to
https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.referer?view=netframework-4.8
"If the AllowAutoRedirect property is true, the Referer property is set automatically when the request is redirected to another site."

I tried the repro on .NET Framework as well as .NET Core. Neither set the HttpWebRequest.Referer property automatically on autoredirect handling. Nor does any 'Referer' request header get sent automatically on the the wire.

I believe that the documentation is incorrect and needs to be fixed.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@scalablecory
Copy link
Contributor

@cubesnyc, would you like to create a PR in the dotnet-api-docs repo?

@scalablecory scalablecory modified the milestones: 5.0.0, Future Jun 22, 2020
Copy link
Contributor

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net backlog-cleanup-candidate An inactive issue that has been marked for automated closure. documentation Documentation bug or enhancement, does not impact product or test code no-recent-activity
Projects
None yet
Development

No branches or pull requests

4 participants