Using IPWorks Components in IntraWeb Applications
In IntraWeb applications, components are not designed to be placed on forms because each user session is handled separately. To avoid shared state and ensure proper request handling, components must be created at runtime within the scope of a request or event.
To use IPWorks components in IntraWeb, create a local instance of the component inside a procedure rather than placing it on the form. You can also assign event handlers programmatically before calling methods on the component. After use, free the instance to release resources.
uses ServerController, ipwcore, ipwhttp;
procedure TIWForm1.IWButton1Click(Sender: TObject);
var
http1: TipwHTTP;
begin
http1 := TipwHTTP.Create(WebApplication);
http1.FOnStatus := Status;
http1.Get('http://www.google.com');
WebApplication.ShowMessage(http1.TransferredData);
http1.Free;
end;
procedure TIWForm1.Status(Sender: TObject; const HTTPVersion: String;
StatusCode: Integer; const Description: String);
begin
//Do something here
end;
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.