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>
<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>
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?
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.
IISDirectForm.zip (10.6 KB)
procedure TFrmMain.btCreateDirectForm2Click(Sender: TObject);
// destroy possible old form
if Assigned(frm) then
frm := TSubDirectForm2.CreateNew(HostPanel.ElementID, nil);
btTransferGet.Enabled := false;
btTransferSet.Enabled := false;
Also created a button to create SubForm2Direct without hosting it in a Panel. Same error.
It is because you are not creating this form as direct form in code.
You should use something like:
procedure TFrmMain.btCreateDirectFormClick(Sender: TObject);
to create it as direct form.
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.
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?
frm.FormContainer := HostPanel.ElementID;
And it (apparently) worked.
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.
You can indeed use FormContainer assignment
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.