Domain name issue with .Net
In a project I need to know the name of the machine where the code run.
Everything ok on different servers (MyServerName for example) , exception of a new one I just finished to setup (Windows 2003).
The name I got is quite unusual, at least for me, NT AUTHORITY.
This is the code (response.write is for testing only)
Someone has an idea ?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ThisDomain As String = GetDomainName()
response.write(ThisDomain)
End Sub
Public Function GetDomainName() As String
Dim tmp As String = Principal.WindowsIdentity.GetCurrent.Name()
Dim pos As Short Dim result As String pos = InStr(tmp, "\")
If pos <> 0 Then
result = Microsoft.VisualBasic.Left(tmp, pos - 1)
End If
Return result
End Function