TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Manoj Bisht
NA
145
0
Get Visitor's IP Address
Mar 31 2009 8:30 AM
Hello Friend,
I want to get the Visitor's IP Address. For it, i'm using the following code
string hostName = Dns.GetHostName();
IPHostEntry hostEntry = Dns.GetHostEntry(hostName);
IPAddress[] ipAddress = hostEntry.AddressList;
string name = null;
for(int i=0;i<ipAddress.Length;i++)
{
name = name + ipAddress[i].ToString()+"<br>";
}
Response.Write(name.ToString());
This code is showing the correct IPAddress of the local computer on localhost but as i upload this code over my server it gives me the following IPAddress not of my computer
66.63.181.68
66.63.181.93
216.45.55.186
Secondly, i use the following code
string hostName1 = Request.UserHostName.ToString();
Response.Write(hostName1.ToString());
But this is giving the IPAddress of the Main computer, I mean there are four computers, sharing the internet connection from my PC and when i visit the page from any of those computers it always give me the IP of my PC
Reply
Answers (
2
)
how to use file upload for multyple file at a time in asp.net
How Can I delete a Cookie....