Link to home
Start Free TrialLog in
Avatar of kingpreetham
kingpreetham

asked on

TWebBrowser authentication

Hi All,
 i am usign TWebBrowser to embed a browser in my form. From the TWebBrowser i call Navigate2() method to navigate to a url. Before the URL opens, a dialog is displayed to get the userid and password from the user.
 is there any way i can pass the information from the browser to the server without interrupting the user with the message box..
Appreciate the help.
Thanks,
Preetham.
Avatar of lnishimura
lnishimura

u can call the url like this

http://username:password@Your_urlAddress
Here is a code
Put 2 edit's (User,Pass) and 1 button

----------------Sample---------------------
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, SHDocVw_TLB;

type
  TForm1 = class(TForm)
    WebBrowser_V11: TWebBrowser_V1;
    Button1: TButton;
    user: TEdit;
    pass: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser_V11.Navigate('http://' + user.text +':' + pass.text + '@192.168.0.254');
end;

end.





Avatar of kingpreetham

ASKER

I did pass the uid:pwd in the url and it worked...
How can i pass it as a part of the authentication header...
does it make a difference as compared to the first method..
I dont know...
But i think its not different than the first one
wont you close this?
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial