C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

IP address


Posted Date: 11 Jan 2009      Posted By: lakshmi      Member Level: Gold     Points: 1   Responses: 3



How to find out the IP address of the systems connected to LAN network using asp.net?
example code





Responses

Author: saravanakumar    12 Jan 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

hi lakshmi,

try this,

//String to Get the Ip Address Of The Machine
string iphost = Dns.GetHostName();
IPHostEntry ip = Dns.GetHostByName(iphost);
string ipadd = ip.AddressList.GetValue(0).ToString();
//string to get IP
string IP;
IP = ipadd.ToString();


regards,
saravan



Author: divya    12 Jan 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Hi,
Check the following

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'To find the ip address of the system
Dim localEntry As Net.IPHostEntry = Dns.GetHostEntry(System.Net.Dns.GetHostName)
For Each address As Net.IPAddress In localEntry.AddressList
Response.Write("You System IP is")
Response.Write(address.ToString())
Next
End Sub



Author: jumbo    12 Jan 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 4

To find the ip address of the machine or machines connected in the networks. There is SMO (Sql Server Management Object) that is provided by the sql server 2005 as a new feature.

So to find out the ip address use SMO object.

or you can use the following code:

Dim ipAddress As Net.IPHostEntry = Dns.GetHostEntry(System.Net.Dns.GetHostName)
For Each address As Net.IPAddress In ipAddress.AddressList

This will give you all the machines in the network.

Enjoy the code.


-------------------------

How to find out the IP address of the systems connected to LAN network using asp.net?
example code



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Applying Themes to Master page
Previous : convert database in sql2005
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use