Export (0) Print
Expand All

HttpWebClientProtocol.AllowAutoRedirect Property

Gets or sets whether the client automatically follows server redirects.

[Visual Basic]
Public Property AllowAutoRedirect As Boolean
[C#]
public bool AllowAutoRedirect {get; set;}
[C++]
public: __property bool get_AllowAutoRedirect();
public: __property void set_AllowAutoRedirect(bool);
[JScript]
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.

Exceptions

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

Remarks

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.

Requirements

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft