![]() |
|
After SendFile Exception GotoURL - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: After SendFile Exception GotoURL (/thread-2508.html) |
After SendFile Exception GotoURL - matija - 09-17-2021 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. RE: After SendFile Exception GotoURL - Alexandre Machado - 09-17-2021 You can't redirect after SendFile(). SendFile() is a download and the browser won't respond to any other content (javascript or html) afterwards |