locked
Lightswitch VB.net Get URL & Port RRS feed

  • Question

  • Hi

    Is it possible to get the URL and port where an app is residing through code?

    I need to assign a string variable the value of my LS Server URL & port.

    If possible please could you provide some sample code in vb.net

    Thank you in advance

    Monday, September 29, 2014 3:12 PM

Answers

  • This is in C# but you should be able to translate:

    How to get hosting website url in silverlight application?

    Basically:

    // This will give you the location of the page hosting the .xap file:
    
    var pageUri = System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString();
    
    // This will give you the location of your .xap file:
    
    var applicationUri = System.Windows.Application.Current.Host.Source.AbsoluteUri;

    Hope this helps.


    Regards, Xander. My Blog

    • Proposed as answer by Simon Jones [MSDL] Tuesday, September 30, 2014 8:45 AM
    • Marked as answer by Angie Xu Monday, October 6, 2014 8:39 AM
    Tuesday, September 30, 2014 4:56 AM

All replies