The problem is quite simple: when you run this locally, the server and the client are the same computer.
C# code runs on the server, not the client. So when you query the DNS you are requesting information from the server DNS, not the client. So the information you get is server centric and have nothing at all to do with the source of the file.
When you ran it locally, the two werethe same PC, so it didn't matter.
Try getting the client IP address with Request.UserHostAddress instead.
"But as I am working on e-commerce website,you know that if I am adding items in the cart the system must know that this pc has added something.the problem is this when I go to another machine I can see what I have add,while machine are different. and when I add item in the cart by using different pc,I can see that Ip address are same of those machines in my db.Please can u give me an idea on how e-commerce work when a user add something in the cart...because shopping cart are different.Means if I am using another machine I can not see what the other user have added. Help on that"
Right - you do not want to use the IP address at all! Definitely not!
An IP address is assigned to a router (or other internet connection device) and all PCs connecting to the internet via that router will have the same IP address - so if you store the data against an IP address then all the customers in the same company will buy the same huge range of goods - not a good idea, really...
The normal way is either to store them in a Database against a login id (which means that customers must log in before they can shop, which puts many people off) or in Cookies, which are stored on the PC making the purchase and thus are separate.
(You can also store the info in the Session, but that does not persist long - if the browser is closed or the user shops for too long you could loose the info - not a good idea for a shopping site)
Using Cookies is simple:
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.cookies.aspx[
^] and is the way most shopping sites work.