05-18-2018, 05:19 PM
Hello,
right now we know how to handle URL parameters when starting a new session. What we do is call a StartupSession method like shown below
Then in the .StartupSession method we look at the parameters and do something like
Then, in the ServerController I set the FStartupForm to the main form
In that way, the URL controls which form the session starts with.
But what if the session is runnig, and the user pastes a URL in the browser and I want to show a form within that session based on the URL?
For example, I am making a simple CMS system based on TinyMCE, as wrapped by the CGDevTools components. If I want the user to be able to link to pages within the CMS I need to have a link that refers to a custom page within the CMS in the same session. So the link will be something like www.whatever.com/$/customPage="my page name"
So I need to be able to detect those links within a current session and then update the page that is being viewed to the page in the parameters. How can I do that?
right now we know how to handle URL parameters when starting a new session. What we do is call a StartupSession method like shown below
Code:
procedure TWebRegistrationServerController.IWServerControllerBaseNewSession(
ASession: TIWApplication);
begin
ASession.Data := TWebRegistrationSession.Create(nil, ASession);
WebRegistrationSession.SetupSession;
end;
Then in the .StartupSession method we look at the parameters and do something like
Code:
WebRegistrationSession.StartupSession
aValue := WebApplication.Request.QueryFields.Values[aFieldName];
if aValue = option1 then
FStartupForm:=Option1form.Create...
else if aValue = option 2
FStartupForm:=Option2form.Create...
Then, in the ServerController I set the FStartupForm to the main form
Code:
procedure TWebRegistrationServerController.IWServerControllerBaseGetMainForm(
var vMainForm: TIWBaseForm);
begin
vMainForm := WebRegistrationSession.StartForm;
end;
In that way, the URL controls which form the session starts with.
But what if the session is runnig, and the user pastes a URL in the browser and I want to show a form within that session based on the URL?
For example, I am making a simple CMS system based on TinyMCE, as wrapped by the CGDevTools components. If I want the user to be able to link to pages within the CMS I need to have a link that refers to a custom page within the CMS in the same session. So the link will be something like www.whatever.com/$/customPage="my page name"
So I need to be able to detect those links within a current session and then update the page that is being viewed to the page in the parameters. How can I do that?