AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi IdHTTP + Proxy + Anmeldung am Proxy mit eigenem Fenster
Thema durchsuchen
Ansicht
Themen-Optionen

IdHTTP + Proxy + Anmeldung am Proxy mit eigenem Fenster

Ein Thema von RWarnecke · begonnen am 24. Jun 2007 · letzter Beitrag vom 4. Jul 2007
 
Benutzerbild von RWarnecke
RWarnecke

Registriert seit: 31. Dez 2004
Ort: Stuttgart
4.408 Beiträge
 
Delphi XE8 Enterprise
 
#1

IdHTTP + Proxy + Anmeldung am Proxy mit eigenem Fenster

  Alt 24. Jun 2007, 20:00
Hallo zusammen,

wenn ich den Usernamen und das Passwort direkt im Code einfüge funktioniert alles wunderbar. Nur wenn es über das eigene Fenster geht, bekomme ich immer wieder den Fehler 407, das eine Proxy Authentifizierung fehlt oder gebraucht wird. Hier mal mein Code :
Delphi-Quellcode:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdHTTP, IdAuthentication;

type
  TForm2 = class(TForm)
    IdHTTP1: TIdHTTP;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure IdHTTP1ProxyAuthorization(Sender: TObject;
      Authentication: TIdAuthentication; var Handled: Boolean);
  private
    procedure ConfigIdHTTP;
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

uses
  Unit3;

procedure TForm2.ConfigIdHTTP;
begin
  IdHTTP1.ProxyParams.ProxyServer := 'proxy.domain.de';
  IdHTTP1.ProxyParams.ProxyPort := 8080;
  Label1.Caption := IdHTTP1.Get('http://ip.smartcoder.net/txt/');
end;

procedure TForm2.IdHTTP1ProxyAuthorization(Sender: TObject;
  Authentication: TIdAuthentication; var Handled: Boolean);
begin
  if Form3.ShowModal = mrOK then
  begin
    IdHTTP1.ProxyParams.BasicAuthentication := true;
    IdHTTP1.ProxyParams.ProxyUsername := Form3.LabeledEdit1.Text;
    IdHTTP1.ProxyParams.ProxyPassword := Form3.LabeledEdit2.Text;
  end;
end;

procedure TForm2.Button1Click(Sender: TObject);
begin
  ConfigIdHTTP;
end;

end.
Packe ich alles in die Procedure Button1Click, funktioniert es. Ich möchte aber nur dann die Form 3 sehen, wenn der Proxy eine Authentifizierung braucht. Wie mache ich das ?
[delphi]
Rolf Warnecke
App4Mission
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:16 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz