TIWAppForm = class(TIWForm)


class procedure SetAsMainForm;

Use this procedure to set your form as the main form of the application. The call to this class method must be done in the initialization section of your IW form unit. The IntraWeb Application Wizard already adds a call to this method to the form created by the wizard.

class procedure SetURL(const aPath: string; const aDocument: string);

Use this class procedure to set a relative ULR and HTML document to be mapped to the IW form. Same as URL Mapping.

The sample code below maps "/green.html" to the TGreenForm, ie, when the user access /green.html the TGreenForm is shown.

  1. type
  2.   TGreenForm = class(TIWAppForm)
  3.     IWLabel1: TIWLabel;
  4.   public
  5.   end;
  7. implementation
  8. {$R *.dfm}
  10. initialization
  11.   TGreenForm.SetURL(’/’, ‘green.html’);
  13. end.

class function RequestAuth(aRequest: THttpRequest; var rGroup: string): Boolean; virtual;

Override this class procedure to inform if authorization will be requested when the form is to be rendered if Authorization is active in your application.

  1.   TfrmNewItem = class(TIWAppForm)
  2.     …
  3.   public
  4.     class function RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean; override;
  5.   end;
  7.     …
  9. class function TfrmNewItem.RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean;
  10. begin
  11.   // this will make the app request authorization, if no user is logged in
  12.   Result := not Assigned(UserSession.CurrentUser);
  13. end;


OnURLRequest: TOnURLRequest;

Use this event to implement special processment when a IW form is activated through a URL Request (ex: http://www.yoursite.com/green.html). See URL Mapping. You need to include unit IW.Http.Request in your uses clause (interface section).

  1. procedure TGreenForm.IWAppFormURLRequest(aSender: TIWAppForm;
  2.   aRequest: THttpRequest);
  3. begin
  4.   if Pos(aRequest.Referer, ‘192.168’) = 0 then begin
  5.     WebApplication.TerminateAndRedirect(’https://www.atozed.com’);
  6.   end;
  7. end;
  9. initialization
  10.   TGreenForm.SetURL(’/’, ‘green.html’);