Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get url params 15.1.5
#1
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
Reply
#2
(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
Reply
#3
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
Reply
#4
Yes the last variant is the best one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)