Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URL param with THandler
#1
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
Reply
#2
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.
Reply
#3
Hi

WebApplication.RunParams.Count = 0 , thats the problem

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


Forum Jump:


Users browsing this thread: 2 Guest(s)