另一个asp.net/c#应用程序通过带有查询字符串的链接打开我的WPF应用程序。当我的WPF应用程序在浏览器中打开或启动时,如何捕获或获取URL?
答案 0 :(得分:0)
https://msdn.microsoft.com/en-us/library/ms172242.aspx
private NameValueCollection GetQueryStringParameters()
{
NameValueCollection nameValueTable = new NameValueCollection();
if (ApplicationDeployment.IsNetworkDeployed)
{
string queryString = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;
nameValueTable = HttpUtility.ParseQueryString(queryString);
}
return (nameValueTable);
}
答案 1 :(得分:0)
根据Jonathan Allen的建议,下面我的工作代码避免使用System.Web参考HttpUtility
{{1}}