Calling Windows application from Web application

给你一囗甜甜゛ 提交于 2019-12-24 12:04:00

问题


i want to call Windows application from Web application. i tried below code :

here "AppA_VB" is my running desktop app. and i have another web app, in which i added the reference of desktop app. It's working fine when i run the web app on my local pc, but it's not after publish.

AppA_VB.Form1 appAform = new AppA_VB.Form1(); appAform.Show();

        var c = GetAll(appAform, typeof(System.Windows.Forms.TextBox));

        foreach (System.Windows.Forms.TextBox t in c)
        {
            if (t.TabIndex == 1)
            {
                t.Text = TxtName.Text;
            }
            if (t.TabIndex == 2)
            {
                t.Text = TxtAddress.Text;
            }

            if (t.TabIndex == 3)
            {
                t.Text = TxtStandards.Text;
            }
        }

        var b = GetAll(appAform, typeof(System.Windows.Forms.Button));

        foreach (System.Windows.Forms.Button btn in b)
        {
            if (btn.Text.ToString().ToLower() == "save")
            {
                btn.PerformClick();
            }
        }

And i have also tried this one ,

System.Diagnostics.Process process1 = new System.Diagnostics.Process();

        process1.StartInfo.FileName = Convert.ToString(ConfigurationManager.AppSettings["ExePath"]);

        // Start the process 

        process1.Start();

It's also not working after publish.

What i missing in it. Thanks.


回答1:


It was(Installed app folder ) missing the proper permission. I gave it, it works fine. :)




回答2:


You should try ClickOnce deployment which allows you to publish Windows-based applications to a server.

Try this:

System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = Request.MApPath("yourFilePath.application");
process1.Start();


来源:https://stackoverflow.com/questions/15406684/calling-windows-application-from-web-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!