12-09-2011 02:49 PM
I need a way to pass a parameter to the WebUI. Basically I need a way of allowing the user to edit some local file (could be txt or the html file itself or whatever) in that directory or something that will inform the program the IP Address of the server it needs to connect to. Yes we could rebuild the entire application every time we wanted a change and yes we could prompt the user for an ip address at the start but both of these are far more cumbersome than I would like. I know you can pass parameters to a .xap, but with the custom build that WebUI does I am not sure what the best way of getting "constant" data to the webserver that can be recieved after build but prior to a prompt that runs every time.
12-12-2011 08:24 AM
What you need is the Application URL node from the HTTP palette. This gives your code access to the full url of the page containing your deployed applicaiton. Your users can then use the ? syntax to provide additional information in the url. For example if you application is deployed at http://yourserver/webapp.html, they could add an IP address as http://yourserver/webapp.html?188.8.131.52. If you have multiple pieces of information, a syntax like the following is typically used: http://yourserver/webapp.html?ip=184.108.40.206&port=
This node will return empty strings when run in the development environment, so you probably want to put a check in your code that will return a default string if the output is empty. This allows you to still run the code in the editor while still exercising your URL parsing code.