Command line arguments passed through URL?

Is it possible to access/pass command line arguments for a Windows Forms exe launched from browser


Answer this question

Command line arguments passed through URL?

  • Michael AbiEzzi

    Unfortunately as far as I know there is no way to do it in V1.1 for the framework.



  • Kal-El

    To enable ClickOnce to pass arguments to the applications, there are two conditions you need to meet. First, use the following API in your application: 

    System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri;

    This API returns the application the whole URI. e.g. http://mysite.com/foo.application name=bar

    Second, your deployment manifest must set trustURLParameters to true.  You can check to box, "Allow URL parameters to be passed to application.", which can be found on the Publish Options dialog box of the Publish tab of the Project Properties dialog box.

  • KjeZ

    Hi Ralph,

    I was not talking about command line arguments in general. My specific need is to be able pass the arguments like this http://mydomain/myapp.exe arg1=1&arg2=2 to the application's main method when the application is deployed on the Web Server.

  • levi3man

    Thanks for the answer Patty.

    I understand what you are saying and actually I should have said it before, but isn't it possible at all in v1.1.4322

  • Tom Freeland

    Hi,

    use a main method like this:

    public static void Main (string[] args)
    public static int Main (string[] args)

    then youl fin in args[0] the first argument in args[1] the second, etc.

  • Command line arguments passed through URL?