How to get the hostname or IP address of the server?
Answers were Sorted based on User's Feedback
Answer / praveen
string IpAddress=HttpContext.Current.Request.UserHostName;
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / soumya
Dim myHost As String = System.Net.Dns.GetHostName
Dim myIPs As System.Net.IPHostEntry =
System.Net.Dns.GetHostByName(myHost)
MessageBox.Show("The name of the host is = " &
myIPs.HostName, "Host Name", MessageBoxButtons.OK,
MessageBoxIcon.Information)
For Each myIP As System.Net.IPAddress In myIPs.AddressList
MessageBox.Show("The IP address of host is = " &
myIP.ToString, "Host IP Address", MessageBoxButtons.OK,
MessageBoxIcon.Information)
Next
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between encrypting a password and applying a hashing?
Differentiate between managed and unmanaged code?
Explain the different parts of an assembly?
What are data types in .NET?
Can a try block have nested try blocks?
Explain the differences between server-side code and client-side code.
Can a try block have more than one catch block?
What are channels in .NET Remoting?
What is lambda expressions in c#?
Is there any inbuilt tool or command provided by .NET to view the code inside the assembly?
Without UDDI, is it possible to access a remote web service ?
1 Answers RR, TCS, Tech Mahindra,
How can you assign an rgb color to a system.drawing.color object?