AllowAutoRedirect Property
Collapse the table of content
Expand the table of content

HttpWebClientProtocol.AllowAutoRedirect Property

Gets or sets whether the client automatically follows server redirects.

[Visual Basic]
Public Property AllowAutoRedirect As Boolean
public bool AllowAutoRedirect {get; set;}
public: __property bool get_AllowAutoRedirect();
public: __property void set_AllowAutoRedirect(bool);
public function get AllowAutoRedirect() : Boolean;
public function set AllowAutoRedirect(Boolean);

Property Value

true to automatically redirect the client to follow server redirects; otherwise, false. The default is false.


Exception Type Condition
WebException The AllowAutoRedirect property is false and the Web server attempts to redirect the request.


If a client sends authentication information, such as a user name and password, you do not want to enable the server to redirect, because this can compromise security.

An WebException is thrown if the AllowAutoRedirect property is false and the Web server attempts to redirect the request. The Response property contains an HttpWebResponse object, where both the StatusCode and Headers properties will reflect details regarding the attempted redirect. The StatusCode property will contain an HttpStatusCode equivalent to one the HTTP redirect status codes (301, 302, and 307) and the Location header within the Headers collection will point to the URI that the request was attempted to be redirected to.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

HttpWebClientProtocol Class | HttpWebClientProtocol Members | System.Web.Services.Protocols Namespace | AllowAutoRedirect

© 2016 Microsoft