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

Dim instance As WebRequest Dim value As Boolean value = instance.PreAuthenticate instance.PreAuthenticate = value
/** @property */ public boolean get_PreAuthenticate () /** @property */ public void set_PreAuthenticate (boolean value)
public function get PreAuthenticate () : boolean public function set PreAuthenticate (value : boolean)
事前認証する場合は true。それ以外の場合は false。


最初の要求を除き、PreAuthenticate プロパティは、サーバーがチャレンジするまで待機せずに、後続の要求で認証情報を送信するかどうかを指定します。PreAuthenticate が false の場合、WebRequest は、認証情報を送信する前に、認証チャレンジを待機します。
![]() |
---|
WebRequest クラスは、abstract クラスです。実行時の WebRequest インスタンスの実際の動作は、System.Net.WebRequest.Create メソッドで返される派生クラスによって決まります。既定値および例外の詳細については、HttpWebRequest や FileWebRequest などの派生クラスの説明を参照してください。 |

PreAuthenticate プロパティを true に設定して、Credentials プロパティに格納されている NetworkCredential をリソース要求と共に送信する例を次に示します。
' Create a new webrequest to the mentioned URL. Dim myWebRequest As WebRequest = WebRequest.Create(url) ' Set 'Preauthenticate' property to true. myWebRequest.PreAuthenticate = True Console.WriteLine(ControlChars.Cr + "Please Enter ur credentials for the requested Url") Console.WriteLine("UserName") Dim UserName As String = Console.ReadLine() Console.WriteLine("Password") Dim Password As String = Console.ReadLine() ' Create a New 'NetworkCredential' object. Dim networkCredential As New NetworkCredential(UserName, Password) ' Associate the 'NetworkCredential' object with the 'WebRequest' object. myWebRequest.Credentials = networkCredential ' Assign the response object of 'WebRequest' to a 'WebResponse' variable. Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
// Create a new webrequest to the mentioned URL. WebRequest myWebRequest=WebRequest.Create(url); // Set 'Preauthenticate' property to true. Credentials will be sent with the request. myWebRequest.PreAuthenticate=true; Console.WriteLine("\nPlease Enter ur credentials for the requested Url"); Console.WriteLine("UserName"); string UserName=Console.ReadLine(); Console.WriteLine("Password"); string Password=Console.ReadLine(); // Create a New 'NetworkCredential' object. NetworkCredential networkCredential=new NetworkCredential(UserName ,Password); // Associate the 'NetworkCredential' object with the 'WebRequest' object. myWebRequest.Credentials=networkCredential; // Assign the response object of 'WebRequest' to a 'WebResponse' variable. WebResponse myWebResponse=myWebRequest.GetResponse();
// Create a new webrequest to the mentioned URL. WebRequest^ myWebRequest = WebRequest::Create( url ); // Set 'Preauthenticate' property to true. Credentials will be sent with the request. myWebRequest->PreAuthenticate = true; Console::WriteLine( "\nPlease Enter your credentials for the requested Url" ); Console::WriteLine( "UserName" ); String^ UserName = Console::ReadLine(); Console::WriteLine( "Password" ); String^ Password = Console::ReadLine(); // Create a New 'NetworkCredential' object. NetworkCredential^ networkCredential = gcnew NetworkCredential( UserName,Password ); // Associate the 'NetworkCredential' object with the 'WebRequest' object. myWebRequest->Credentials = networkCredential; // Assign the response object of 'WebRequest' to a 'WebResponse' variable. WebResponse^ myWebResponse = myWebRequest->GetResponse();
// Create a new webrequest to the mentioned URL. WebRequest myWebRequest = WebRequest.Create(url); // Set 'Preauthenticate' property to true. // Credentials will be sent with the request. myWebRequest.set_PreAuthenticate(true); Console.WriteLine("\nPlease Enter ur credentials for" + " the requested Url"); Console.WriteLine("UserName"); String userName = Console.ReadLine(); Console.WriteLine("Password"); String password = Console.ReadLine(); // Create a New 'NetworkCredential' object. NetworkCredential networkCredential = new NetworkCredential( userName, password); // Associate the 'NetworkCredential' object with the 'WebRequest' // object. myWebRequest.set_Credentials(networkCredential); // Assign the response object of 'WebRequest' to a 'WebResponse' // variable. WebResponse myWebResponse = myWebRequest.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に収録されているすべての辞書からWebRequest.PreAuthenticate プロパティを検索する場合は、下記のリンクをクリックしてください。

- WebRequest.PreAuthenticate プロパティのページへのリンク