Atozed Forums

Full Version: get url params 15.1.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
intraweb 15.1.5
I have had no luck getting a session url params in serverController-onGetMainForm
so I cannot change main form according to an identified param like http://url/?test
(11-03-2019, 12:08 PM)MrSpock Wrote: [ -> ]After a couple of hours I have found a solution
Code:
1) in UserSession class in "Public" sector put variable "parametr"

2) in UserSession.OnCreate put

  if WebApplication.RunParams.Count>0
  then
    parametr:=WebApplication.RunParams[0]
  else
    parametr:='';

3) in ServerController.OnGetMainForm put

  if UserSession.parametr = 'steg'
  then
    vmainForm:=TIWForm9.Create(WebApplication)
  else
    vmainForm:=TIWForm2.Create(WebApplication)

4) start your application with

http://YourAppDomain.org/$/start?steg
Another idea is not to put any code in user session unit

Code:
in ServerController.OnGetMainForm put

  if WebApplication.RunParams.Count>0
  then
  begin
     if WebApplication.RunParams[0]='steg'
     then
        vmainForm:=TIWForm9.Create(WebApplication)
     else
        vmainForm:=TIWForm2.Create(WebApplication)
  end
  else
     vmainForm:=TIWForm2.Create(WebApplication)  //usual main form
Yes the last variant is the best one.