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

Is .net front end or backend?

0 Answers  


What is the use of design pattern?

0 Answers  


Explain the .NET architecture.

9 Answers   HCL, Idhasoft, Scandent, TCS, TechnoLinks,


What is the native image generator?

0 Answers  


What are the different types of assemblies?

3 Answers  






Which namespace is require to used XML in .NET?

0 Answers   Sans Pareil IT Services,


What does cil do?

0 Answers  


questions on various scenarios on exception handling? like for example.... try { a; b; ...exception occurs here...what happens...will catch execute or will finally execute...will c execute c; } catch { a; b; c; } fianlly { a; b; }

1 Answers   Manhattan,


Explain what is a delegate?

0 Answers  


Explain constructor.

2 Answers   Wipro,


is c#.net supports multiple inheritance?

10 Answers  


Explain about .Net products?

0 Answers  


Categories