[Gambas-user] How to load a new page on gb.web by code

Benoît Minisini benoit.minisini at gambas-basic.org
Wed Sep 20 01:03:04 CEST 2023


Le 20/09/2023 à 00:48, T Lee Davidson a écrit :
 > ...
> 
> Hopefully, Benoît can clarify why this isn't working the way it seems it 
> should.
> 

A WebPage is just a class that prints HTML to the standard output, 
aiming at being run from a CGI script.

This HTML is printed by a function generated by the Gambas compiler from 
the form defined in the IDE. This function is called by the Render() method.

So if you call Response.Redirect() inside a WebPage, it's too late. You 
are currently generating the response, and Response.Redirect() must be 
called before Response.Begin(), otherwise it has no effect.

In other words, the choose of which WebPage you want to render must me 
done outside of any WebPage.

For a real understanding, the entire 'gb.web' component is written in 
Gambas, and the source code is available.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list