WebRequestPSCmdlet.PreserveAuthorizationOnRedirect Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the PreserveAuthorizationOnRedirect property.
[System.Management.Automation.Parameter]
public virtual System.Management.Automation.SwitchParameter PreserveAuthorizationOnRedirect { get; set; }
[<System.Management.Automation.Parameter>]
member this.PreserveAuthorizationOnRedirect : System.Management.Automation.SwitchParameter with get, set
Public Overridable Property PreserveAuthorizationOnRedirect As SwitchParameter
Property Value
- Attributes
Remarks
This property overrides compatibility with web requests on Windows. On FullCLR (WebRequest), authorization headers are stripped during redirect. CoreCLR (HTTPClient) does not have this behavior so web requests that work on PowerShell/FullCLR can fail with PowerShell/CoreCLR. To provide compatibility, we'll detect requests with an Authorization header and automatically strip the header when the first redirect occurs. This switch turns off this logic for edge cases where the authorization header needs to be preserved across redirects.