How to get the hostname or IP address of the server?

Answers were Sorted based on User's Feedback



How to get the hostname or IP address of the server?..

Answer / praveen

string IpAddress=HttpContext.Current.Request.UserHostName;

Is This Answer Correct ?    3 Yes 0 No

How to get the hostname or IP address of the server?..

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

Post New Answer

More Dot Net General Interview Questions

What is alias ? Is it used in .Net ?

0 Answers   MCN Solutions,


How can we convert XML data into DataBase table IN .Net?

3 Answers   Indus Media, Wipro,


what is the use of "mustinherit" keyword?

2 Answers  


What are the authentication methods in .net?

0 Answers  


SAP Business One(this is intigrated tool of .net)

0 Answers   TCS,






Please explain what is the difference between encrypting a password and applying a hashing?

0 Answers  


How to store and retrieve images in SQL server database through VB.NET?

1 Answers  


What is different between Web User Control and Web Custom Control?

1 Answers  


Explain what rare the types of jit and what is econo-jit?

0 Answers  


What application do you use to install a Windows service?

1 Answers  


What is Global Assembly Cache (GAC) and what is the Purpose of it?

1 Answers  


What is the advantage of packaging over xcopy in .net?

0 Answers  


Categories