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

Closed
cubesnyc opened this issue Oct 19, 2019 · 5 comments · Fixed by dotnet/dotnet-api-docs#10910
Labels
area-System.Net documentation Documentation bug or enhancement, does not impact product or test code

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
Copy link
Contributor

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@dotnet-policy-service dotnet-policy-service bot removed this from the Future milestone Jan 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2025
@dotnet-policy-service dotnet-policy-service bot removed no-recent-activity backlog-cleanup-candidate An inactive issue that has been marked for automated closure. labels Feb 5, 2025
@ManickaP ManickaP reopened this Feb 5, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 5, 2025
@ManickaP
Copy link
Member

ManickaP commented Feb 5, 2025

The docs are still not fixed.

ManickaP added a commit to dotnet/dotnet-api-docs that referenced this issue Feb 5, 2025
Fixes dotnet/runtime#31225

Retested the WebRequest, it does not auto-include the Referer header in any of the requests during redirect.
ManickaP added a commit to dotnet/dotnet-api-docs that referenced this issue Feb 5, 2025
Fixes dotnet/runtime#31225

Retested the WebRequest, it does not auto-include the Referer header in any of the requests during redirect.
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Feb 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net documentation Documentation bug or enhancement, does not impact product or test code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants