开发者

Additional argument to process during start of app from CLI c#

I have made a HTML parser thanks to the help of this website but I am running into a new obstacle. I have a webserver that hosts configuration files that I want parsed. Instead of loading my app and inserting the link I want to just pass 开发者_如何学运维on a argument to my app directly from the website, for example:

htmlparser.exe http://thisismyconfig.com/config.cfg

And I want the app to load up and run the parse function in my code. It is a .NET application and I think I need to utilize ClickOnce but not too sure. Any help is appreciated, thank you!

UPDATE***

Ok, so with the following code my app does what it should but it faces one last problem (site keeps formatting the code incorrectly):

        private void Form1_Load(object sender, EventArgs e)
        {

            string[] args = Environment.GetCommandLineArgs();
            foreach (string arg in args)
            {
                MyURL = args[1];
                runtimeButton_Click(sender, e);
            }
}

but my URL that I feed it in the argument is:

http://jossc/configtc.aspx?IP=201.73.128.15&m=c

What is going on?

For some reason it removes the last 4 characters: &m=c


So you've got a console app and you want to hand to it the HTTP address to a config file?

You don't need ClickOnce for that. Inside your console app, look at Environment.CommandLine to get the command line arguments passed to your app. See MSDN's Command Line Parsing Tutorial for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜