Atozed Forums

Full Version: URL param with THandler
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I use a Thandler like this:


Code:
  with THandlers.Add('/NewUser/', '', TContentForm.Create(TFrmNewUser)) do
  begin
     CanStartSession := True;
     RequiresSessionStart := True;
    end;

My url looks like:

Code:
http://127.0.0.1:8080/NewUser/$/?xxx=1

In the OnCreate of the TFrmNewUser form i coded:

Code:
  if (WebApplication.RunParams.IndexOfName('xxx') = -1) then
    param := 'no param'
  else
    param := WebApplication.RunParams.Values['xxx'];

But params stays empty.

What i'm missing?

Eric
If I had a trouble like this, I would use the simplest code I could.
Code:
procedure TIWServerController.IWServerControllerBaseGetMainForm(
  var vMainForm: TIWBaseForm);
begin
  if WebApplication.RunParams.Count>0
  then
  begin
    if WebApplication.RunParams[0]='steg'
    then
      vmainForm:=TIWForm9.Create(WebApplication)
    else  
      vmainForm:=TIWForm2.Create(WebApplication) //main form
  end
  else
    vmainForm:=TIWForm2.Create(WebApplication) //main form
end;
What you need, as I see, is to choose the starting form depending also on the user, so you could just use another param to detect the user. Maybe there is another simpler way, but if something works for me, I use the code without looking for another solution.
Hi

WebApplication.RunParams.Count = 0 , thats the problem

Eric
The problem was that i tested the params in the OnCreate of the ContentForm, should be in the Execute method