Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
After SendFile Exception GotoURL
#1
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.
Reply
#2
You can't redirect after SendFile(). SendFile() is a download and the browser won't respond to any other content (javascript or html) afterwards
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)