Direct call DownloadFile (SourceFile, DestFile) this function, there is no session information, automatically redirected to the login screen, not through the verification, file access failure,
Separately in IE browser, login manually copy the address to download the file, but run DELPHI after login daemon, or can't download the file, and file is just a redirect page after, I want to write how to write using DELPHI session session, I was able to get to that file,
Uses URLMon ShellApi;
The function DownloadFile (SourceFile, DestFile: string) : Boolean;
The begin
Try
Result:=UrlDownloadToFile (nil, PChar (SourceFile), PChar (DestFile), 0, nil)=0.
Except,
Result:=False;
end;
end;
Procedure TForm1. For. Click (Sender: TObject);
Const
//URL Location
SourceFile:='http://www.google.com/intl/de/images/home_title.gif';
//the Where to save the file
DestFile:='c: \ temp \ Google - image. GIF';
The begin
If DownloadFile (SourceFile DestFile) then
The begin
ShowMessage (' Download succesful! ');
//Show downloaded image in your browser
ShellExecute (Application. Handle, PChar (' open '), PChar (DestFile), PChar (' '), nil, SW_NORMAL)
End
The else
ShowMessage (' Error while downloading '+ SourceFile)
end;
CodePudding user response:
With httpdebug caught, first under the ie, from login to download operation time, analyse, login and download the message, Delphi side indy was used to simulate the canCodePudding user response:
Can you specifically, did not make the httpdebug with built-in or download aCodePudding user response: