【问题标题】:Why is ActivationUri null by using Chrome?为什么使用 Chrome 时 ActivationUri 为空?
【发布时间】:2012-12-02 14:07:19
【问题描述】:

在IE中运行URL“http://localhost/?Id=User1”,ApplicationDeployment.CurrentDeployment.ActivationUri.Query返回“?Id=User1”,没错。

在 Chrome 中运行 URL“http://localhost/?Id=User1”时,ApplicationDeployment.CurrentDeployment.ActivationUri 为空,为什么?如何解决这个问题?

代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Deployment;
using System.Deployment.Application;

namespace COSample
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                MessageBox.Show("Network");
                MessageBox.Show(ApplicationDeployment.CurrentDeployment.ActivationUri.Query);
            }
            else
                MessageBox.Show("Local");
            Application.Run(new Form1());
        }
    }
}

【问题讨论】:

  • 你能显示围绕上述语句的环绕代码吗?
  • 我添加了示例代码,谢谢。

标签: c# .net google-chrome deployment clickonce


【解决方案1】:

您是否安装了add-in for ClickOnce for Chrome

要在 Click Once 应用中使用查询参数,请查看 this article。它谈到在在线/离线应用程序中使用它们,但代码可以以任何方式工作。

【讨论】:

  • 我安装了插件,但还是不行。可以启动应用,问题是如果使用 Chrome,ActivationUri 为空。
  • 其实仔细想想,ActivationURI 不是一直为空吗?这不是您获取查询参数的方式。我将编辑我的答案,以包含有关在 CLickOnce 应用程序中使用查询参数的链接。
猜你喜欢
  • 2015-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-11
  • 1970-01-01
  • 2019-12-20
  • 2021-06-05
  • 1970-01-01
相关资源
最近更新 更多