I believe it was BrowserInteropHelper.Source
:
Gets the uniform resource identifier (URI) for the location from which a XAML browser application (XBAP) application was launched.
Вопрос
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.
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
How can I access the URL that was used to launch an xbap application from within the application itself?
Решение
I believe it was BrowserInteropHelper.Source
:
Gets the uniform resource identifier (URI) for the location from which a XAML browser application (XBAP) application was launched.