Aracılığıyla paylaş


FileWebResponse.ResponseUri Özellik

Tanım

Yanıtı sağlayan dosya sistemi kaynağının URI'sini alır.

public:
 virtual property Uri ^ ResponseUri { Uri ^ get(); };
public override Uri ResponseUri { get; }
member this.ResponseUri : Uri
Public Overrides ReadOnly Property ResponseUri As Uri

Özellik Değeri

Uri

Uri Yanıtı sağlayan dosya sistemi kaynağının URI'sini içeren.

Örnekler

Aşağıdaki örnek, yanıtı sağlayan dosya sistemi kaynağının URI'sini almak için öğesini kullanır ResponseUri .

void GetPage( String^ url )
{
   try
   {
      Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) );
      
      // Create a 'FileWebrequest' object with the specified Uri .
      FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) );
      
      // Send the 'fileWebRequest' and wait for response.
      FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() );
      Console::WriteLine( "\nThe Uri of the file system resource that provided the response is :\n {0}\n\n", myFileWebResponse->ResponseUri );
      
      // Release resources of response object.
      myFileWebResponse->Close();
   }
   catch ( WebException^ e ) 
   {
      Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message );
   }
}
public static void GetPage (String url)
{
    try
    {
        Uri fileUrl = new Uri ("file://" + url);

        // Create a 'FileWebrequest' object with the specified Uri .
        FileWebRequest myFileWebRequest = (FileWebRequest)WebRequest.Create (fileUrl);

        // Send the 'fileWebRequest' and wait for response.
        FileWebResponse myFileWebResponse = (FileWebResponse)myFileWebRequest.GetResponse ();

        Console.WriteLine ("\nThe Uri of the file system resource that provided the response is :\n{0}\n\n", myFileWebResponse.ResponseUri);

        // Release resources of response object.
        myFileWebResponse.Close ();
    }
    catch (WebException e)
    {
        Console.WriteLine ("\r\nWebException thrown. The Reason for failure is : {0}", e.Status);
    }
    catch (Exception e)
    {
        Console.WriteLine ("\nThe following Exception was raised : {0}", e.Message);
    }
}
Public Shared Sub GetPage(ByVal url As [String])
    Try
        Dim fileUrl As New Uri("file://" + url)
        ' Create a 'FileWebrequest' object with the specified Uri. 
        Dim myFileWebRequest As FileWebRequest = CType(WebRequest.Create(fileUrl), FileWebRequest)
        ' Send the 'fileWebRequest' and wait for response.
        Dim myFileWebResponse As FileWebResponse = CType(myFileWebRequest.GetResponse(), FileWebResponse)
        Console.WriteLine("The Uri of the file system resource that provided the response is : {0}", myFileWebResponse.ResponseUri)
        myFileWebResponse.Close()

    Catch e As WebException
        Console.WriteLine(ControlChars.Lf + ControlChars.Cr + "The Reason for failure is : {0}", e.Status)
    Catch e As Exception
        Console.WriteLine(ControlChars.Cr + "The following exception was raised : {0}", e.Message)
    End Try

Açıklamalar

özelliği, ResponseUri yanıtı sağlayan dosya sistemi kaynağının URI'sini içerir. Bu her zaman istenen dosya sistemi kaynağıdır.

Şunlara uygulanır