Closed
Labels
GeneralQuestions, how-tos and everything else.Questions, how-tos and everything else.
Description
Rui Oliveira asked 2016-11-15 15:25:01 UTC
How to pass arguments variables in the application URL?
In VWG we have something like this:
../Post.Mainform.wgx?Name=Aaa&Pwd=xpto
And how we get them in code side?
Thanks & regards,
Rui
Metadata
Metadata
Assignees
Labels
GeneralQuestions, how-tos and everything else.Questions, how-tos and everything else.
Activity
itg-assistant commentedon Jun 12, 2026
Luca answered 2016-11-15 15:28:58 UTC
Hi Rui,
In two ways:
At startup you get them in the Main method. See the comment in the auto generated Program class, or see https://docs.wisej.com/docs/concepts/configuration look for startup.
At any time, you can use Application.QueryString and Application.StartupUri.
Best,
Luca
itg-assistant commentedon Jun 12, 2026
Rui Oliveira answered 2016-11-15 15:37:28 UTC
Is necessary use the “Post” string in URL too?
Thanks & Regards,
Rui
itg-assistant commentedon Jun 12, 2026
Luca answered 2016-11-15 15:46:03 UTC
No, Wisej pages are standard html, aspx, mvc, or anything else that the browser can load.
http://localhost/myapp
http://localhost/myapp/default.html
http://localhost/myapp?arg=1
http://localhost/myapp/default.html?arg=1
All work.
itg-assistant commentedon Jun 12, 2026
Sebastián Serrisuela answered 2016-12-01 16:41:56 UTC
I still can not get the URL parameters.
Application.QueryString always returns 0.
Do I enter the parameters in the URL?
itg-assistant commentedon Jun 12, 2026
Luca answered 2016-12-01 18:46:01 UTC
Hi Sebastian, the arguments go after the URL:
http://localhost/myapp?arg1=hello
In your code you will find the startup arguments in Program.Main(NameValueCollection args) and always in Application.QueryString (which uses the same collection as HttpContext.QueryString).
AlertBox.Show(Application.QueryString["arg1"]);
Best,
Luca
itg-assistant commentedon Jun 12, 2026
Sebastián Serrisuela answered 2016-12-02 12:33:56 UTC
I still can not get the URL arguments.
This is my URL: http://localhost:4988/Quirofano?sid=15
My JSON: “startup”: “Quirofano.Program.Main, Quirofano”
Is there any configuration in the project?
itg-assistant commentedon Jun 12, 2026
Frank (ITG) answered 2016-12-02 13:14:15 UTC
Hi Sebastian, sid and lang cannot be used for that purpose. Those 2 are reserved for Wisej.
Hope that helps, Frank.
itg-assistant commentedon Jun 12, 2026
Sebastián Serrisuela answered 2016-12-02 13:28:02 UTC
Thank you! I already take the argument.
Now, if I change the value of the argument in the URL, it does not take the change. You need a POST (like VWG)
itg-assistant commentedon Jun 12, 2026
Frank (ITG) answered 2016-12-02 16:03:48 UTC
Hi Sebastian,
I have setup a small sample that shows to extract the URL parameters:
Download the sample here
Hope that helps.
Best regards
Frank
itg-assistant commentedon Jun 12, 2026
Sebastián Serrisuela answered 2016-12-02 17:03:24 UTC
Thank you! It was very useful.