|
<< Click to Display Table of Contents >> Navigation: Forum > After SendFile Exception GotoURL |
09-17-2021, 10:03 AM:
My case:
Define IWServerControllerBaseConfig
with THandlers.Add('', 'main', TContentForm.Create(TMainForm)) do
begin
CanStartSession := true;
RequiresSessionStart := false;
end;
with THandlers.Add('', 'help', TContentForm.Create(THelpForm)) do
begin
CanStartSession := true;
RequiresSessionStart := false;
end;
I have in HelpForm Download Button for my PDF.
procedure DownloadButtonClick(Sender: TObject) ;
begin
WebApplication.SendFile('My.pdf', true, '','');
WebApplication.GotoURL('/main');
end;
OnClick -> ERROR Exception error raised, with message : Reply type already set.
09-17-2021, 10:22 AM:
You can't redirect after SendFile(). SendFile() is a download and the browser won't respond to any other content (javascript or html) afterwards