Share via


WebRequestPSCmdlet.PreserveAuthorizationOnRedirect Property

Definition

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.

Applies to