locked
Get Machine Name RRS feed

  • Question

  • Hi,

    How to get the machine name in client code.

    Thanks.


    Nicolas Parra

    Friday, February 1, 2013 4:04 PM

All replies

  • Not possible. 

    Remember that your silverlight/lightswitch app can run as well on a MAC book, so a potential GetMachineName() method would require an OS specific implementation

    Maybe provide some context why you need it. This could potentially trigger some ideas by other forum readers...


    paul van bladel

    Friday, February 1, 2013 5:28 PM
  • Option Strict Off
    Imports System.Runtime.InteropServices.Automation
    
    Public Class Utilities
        Public Shared Function GetComputerName() As String
            If AutomationFactory.IsAvailable = True Then
                Dim cmd = AutomationFactory.CreateObject("WScript.Shell")
                Return cmd.ExpandEnvironmentStrings("%computername%")
            Else
                Throw New InvalidOperationException("This feature is available only in desktop client applications")
            End If
        End Function
    End Class
    


    Norman

    Friday, February 1, 2013 7:50 PM
  • Hi Norman,

    But my app is web.

    Thanks.


    Nicolas Parra

    Friday, February 1, 2013 10:05 PM