简体   繁体   English

如何获取用于启动XBAP的URL?

[英]How can I get the URL used to launch an XBAP?

If someone launches my xbap from http://myserver/folder/application.xbap , I would like to get the http://myserver/folder/ part of the url from within the application. 如果有人从http://myserver/folder/application.xbap启动我的xbap,我想从应用程序中获取http://myserver/folder/ url的一部分。

How can I do that? 我怎样才能做到这一点?

I have tried: 我努力了:

  • System.IO.Directory.GetCurrentDirectory()
  • System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
  • Environment.CurrentDirectory
  • System.Reflection.Assembly.GetExecutingAssembly().Location
  • AppDomain.CurrentDomain.BaseDirectory
  • System.Windows.Application.Current.StartupUri.AbsolutePath
  • System.Environment.GetCommandLineArgs()[0]
  • System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory

They all return either the local location on my machine that the xbap got downloaded to and is running from, or the location of the executing assembly, such as C:\\Windows\\SysWOW64 它们都返回我的机器上xbap下载到并运行的本地位置,或者执行程序集的位置,例如C:\\Windows\\SysWOW64

How can I access the URL that was used to launch an xbap application from within the application itself? 如何从应用程序本身访问用于启动xbap应用程序的URL?

I believe it was BrowserInteropHelper.Source : 我相信它是BrowserInteropHelper.Source

Gets the uniform resource identifier (URI) for the location from which a XAML browser application (XBAP) application was launched. 获取启动XAML浏览器应用程序(XBAP)应用程序的位置的统一资源标识符(URI)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM