We upgrade our application from .net structure to .net core 2.0.
In it, we use HttpWebRequestto contact the site with AllowAutoRedirectset to false. When the code is executed, the request.GetResponse()Site will return the answer 302, which is fine in the .NET Framework - you can take the answer and process it (we are after the header sign set-cookie).
However, in .net core 2.0, a WebException is thrown:
The remote server returned an error: (302) Found.
I understand that the misconception that 302 should throw an exception, and if the AllowAutoRedirect parameter is set to false, should the response be returned? Is there a way to cause the same behavior as in the .net framework?
source
share