在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());
}
}
}