Поделиться через


HttpWebRequest.AllowAutoRedirect Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether the request should follow redirection responses.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Overridable Property AllowAutoRedirect As Boolean
public virtual bool AllowAutoRedirect { get; set; }

Property Value

Type: System.Boolean
true if the request should automatically follow redirection responses from the Internet resource; otherwise false. The default is true.

Exceptions

Exception Condition
NotImplementedException

This property is not implemented.

Remarks

Set AllowAutoRedirect to true if you want the request to automatically follow HTTP redirection headers to the new location of the resource.

The Authorization header is cleared on auto-redirects and HttpWebRequest automatically tries to re-authenticate to the redirected location. In practice, this means that an application can't put custom authentication information into the Authorization header if it is possible to encounter redirection.

The AllowAutoRedirect property is supported by both the browser and the client HTTP stack.

If the application creates a class which derives from HttpWebRequest and does not override the AllowAutoRedirect property and then tries to get or set the AllowAutoRedirect property, a NotImplementedException is thrown.

Version Notes

Silverlight for the desktop

Do not use this member when targeting Silverlight 4.

Silverlight for Windows Phone Silverlight for Windows Phone

You can use this member when targeting Silverlight for Windows Phone to specify whether the request should follow redirection responses.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.