HttpWebRequest.AllowAutoRedirect プロパティ
アセンブリ: System (system.dll 内)

Dim instance As HttpWebRequest Dim value As Boolean value = instance.AllowAutoRedirect instance.AllowAutoRedirect = value
/** @property */ public boolean get_AllowAutoRedirect () /** @property */ public void set_AllowAutoRedirect (boolean value)
public function get AllowAutoRedirect () : boolean public function set AllowAutoRedirect (value : boolean)
要求がインターネット リソースからのリダイレクト応答に自動的に従う場合は true。それ以外の場合は false。既定値は true です。

要求を HTTP リダイレクト ヘッダーに自動的に従わせ、リソースの新しい場所に移動する場合は、AllowAutoRedirect を true に設定します。実行するリダイレクトの最大数は、MaximumAutomaticRedirections プロパティで設定します。
AllowAutoRedirect が false に設定されている場合、HTTP ステータス コードが 300 ~ 399 の範囲のすべての応答は、アプリケーションに返されます。

AllowAutoRedirect プロパティを使用して、要求がリダイレクト応答に従うようにするコード例を次に示します。
'This method creates a new HttpWebRequest Object to the mentioned URL. Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create("http://www.contoso.com"), HttpWebRequest) myHttpWebRequest.MaximumAutomaticRedirections = 1 myHttpWebRequest.AllowAutoRedirect = True Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
// Create a new HttpWebRequest Object to the mentioned URL. HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://www.contoso.com"); myHttpWebRequest.MaximumAutomaticRedirections=1; myHttpWebRequest.AllowAutoRedirect=true; HttpWebResponse myHttpWebResponse=(HttpWebResponse)myHttpWebRequest.GetResponse();
// Create a new HttpWebRequest Object to the mentioned URL. HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); myHttpWebRequest->MaximumAutomaticRedirections = 1; myHttpWebRequest->AllowAutoRedirect = true; HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() );
// Create a new HttpWebRequest Object to the mentioned URL. HttpWebRequest myHttpWebRequest = (HttpWebRequest) (WebRequest.Create("http://www.contoso.com")); myHttpWebRequest.set_MaximumAutomaticRedirections(1); myHttpWebRequest.set_AllowAutoRedirect(true); HttpWebResponse myHttpWebResponse = (HttpWebResponse) (myHttpWebRequest.GetResponse());

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHttpWebRequest.AllowAutoRedirect プロパティを検索する場合は、下記のリンクをクリックしてください。

- HttpWebRequest.AllowAutoRedirect プロパティのページへのリンク