When I use direct forms and publish my project in IIS, it generates errors 404 trying to load the form HTML file. No problem when using TMS Web Server, but when hosted in IIS , it raises this error in console, and visually presents the error in the Form area:
<div id="header"><h1>Error del servidor</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>404: archivo o directorio no encontrado.</h2>
<h3>Puede que se haya quitado el recurso que est� buscando, que se le haya cambiado el nombre o que no est� disponible temporalmente.</h3>
</fieldset></div>
</div>
Console:
WebLib.Forms.pas:
I just used direct forms because I don't intend to use any html customization. Must I convert them back to normal WebForm's ? Why is it trying to open HTML once I chose not to have them in my project ? Shouldn't WebLib.Forms somehow check if it's a direct form before trying to load the HTML, or am I missing something to avoid these errors?
Thanks!
Without knowing how you open / load forms, I cannot tell.
It would appear from this error that you are not really using direct forms but still use forms that load the HTML template.
I use form hosting,like in the Demo.
Also created a new direct form in Form Hosting Demo, and added a button. No problem using TMS Web Server, but when publishing to IIS, a similar error: 404 - not found.
Attaching project. IISDirectForm.zip (10.6 KB)
procedure TFrmMain.btCreateDirectForm2Click(Sender: TObject);
begin
// destroy possible old form
if Assigned(frm) then
frm.Close;
frm := TSubDirectForm2.CreateNew(HostPanel.ElementID, nil);
btTransferGet.Enabled := false;
btTransferSet.Enabled := false;
end;
Also created a button to create SubForm2Direct without hosting it in a Panel. Same error.
There's no CreateFormDirect function reference in documentation. Just a CreateForm on page 121.
Once I've been using CreateNew, as I saw in form hosting demo, and have been testing with no errors with TMS Web server, I kept using it.
Anyway, yesterday I changed all of them to normal Web Forms.
I'll try to use this function now.
Thanks.
So then, how could I embed A DirectForm into a Panel, once the examples use CreateNew passing the panels ElementID? Is there another way to embed it after it's been already created?
There must be something hidden that may have side effects, as I'm not running BindEvents, nor BindElemnt as the original code behind (WEB)TControl constructor.