Command Line Arguments for Web

I want to test using some Command Line Arguments in the Shared>Debug area in the IDE for my Web App. I have tried:

u=85
?u=85
/?u=85

But when I run my app in Debug and cycle through the URLParameters, it says that Session.URLParameterCount = 0.

For tempInt As Integer = 0 To Session.URLParameterCount - 1
  Var URLParameterName As String = Session.URLParameterName(tempInt)
  Var URLParameter As String = Session.URLParameter(URLParameterName)
  URLParameter = URLParameter
Next

I tried to retrieve the URLParameters in a Built App, but it still was empty.

How should you add URLParameters to a Debug Session and retrieve URLParameters from either a Debug or Built Session?

These are completely different things, URL parameters are not Command Line arguments

What you can do is, in App.Opening read args() As string. Then reload the session url or so.
In the IDE under “Debug” Command Line Args you set it like:
“–u=something --other=key2”

#If DebugBuild 
For each arg As String in Args
If arg.beginsWith("--u") Then
Var value As string = arg.NthField(2, "=")
If value <> "" Then
// Load value into a session or something. 

End If 
End If 

Next
#EndIf

n th

I know what a Command Line arguments is, as I use them to set the --Port number, etc. Maybe I’m mistaken that this field is not for URLParameters, but for port number changes, etc.

What I’m referring to is:
https://documentation.xojo.com/api/web/websession.html#websession-urlparameter

where I should be able to connect my browser to my Web App and add some optional parameters at the end e.g.

http://example.com?my_favorite_number=42&my_name=Ford
or
http://127.0.0.1:8080/?test=hello

How can I access these URLParameters?

OK, it looks like I have to run my Web App without any URLParameters in a browser window then add the URLParameters after the launch, then they appear!

1 Like