błąd (407) „Wymagane uwierzytelnienie proxy”.

Mam wymaganie takie jak ... chcę uzyskać dostęp do adresu URL (strony logowania, która jest siecią) z winforms. Muszę przekazać poświadczenia do tego adresu URL, a odpowiedzią powinien być kontekst uwierzytelnionej strony internetowej (znaczników).

Napisałem funkcję, która zażąda adresu URL i zwróci odpowiedź. ale otrzymuję kod błędu (407)

„Wymagane uwierzytelnienie proxy”.

Oto mój kod.

private static void GetPageContent(){
    string url = "https://LoginPage.aspx/";
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.Method = "GET";
    // If required by the server, set the credentials.
    //request.Proxy.Credentials = CredentialCache.DefaultCredentials;
    request.Credentials = new NetworkCredential("user1", "testuser#");
    // Get the response.
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    // Display the status.
    Console.WriteLine(response.StatusDescription);
    // Get the stream containing content returned by the server.
    Stream dataStream = response.GetResponseStream();
    // Open the stream using a StreamReader for easy access.
    StreamReader reader = new StreamReader(dataStream);
    // Read the content.
    string responseFromServer = reader.ReadToEnd();
    // Display the content.
    Console.WriteLine(responseFromServer);
    // Cleanup the streams and the response.
    reader.Close();
    dataStream.Close();
    response.Close();
}

questionAnswers(4)

yourAnswerToTheQuestion