How do you get the IP address of a computer using ASP.net?
How do you get the IP address of a computer using ASP.net?
am 31.03.2006 19:51:57 von Progman
How do you get the IP address of a computer using ASP.net?
I tried Request.UserHostAddress and it does not work.
I get
Request for the permission of type
'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
It should be possible, because many web site can show you your ip address.
Re: How do you get the IP address of a computer using ASP.net?
am 31.03.2006 20:52:39 von sirfunusa
You did not read and apply what others have told you. You can never
rely on getting the ip address anyway. AOL users for example, always
will show the same IP, since they go through a proxy. What do you hope
to do with the IP? Hopefully nothing as naive as user personalization
or similar.
Create a one-line test.aspx with the following:
<% Response.Write (Request.ServerVariables("REMOTE_HOST")) %>
Re: How do you get the IP address of a computer using ASP.net?
am 31.03.2006 22:58:54 von Mark Rae
"sirfunusa" wrote in message
news:1143831159.822811.53220@u72g2000cwu.googlegroups.com...
> What do you hope to do with the IP? Hopefully nothing as
> naive as user personalization or similar.
Quite right! Anyone who believes that the the IP address supplied by any
browser to any server is even *remotely* accurate is seriously deluded...
Re: How do you get the IP address of a computer using ASP.net?
am 31.03.2006 23:05:44 von mark
See what I mean?
Re: How do you get the IP address of a computer using ASP.net?
am 01.04.2006 19:01:32 von Progman
"read and apply what others have told you"
sorry but nobody told me about anything to do except to try a line of code.
so nobody told me any instructions. you may be mixed up with another similar
thread.
txs for the input about the aol fact.
the "REMOTE_HOST" wont work.
I hope to identify the users computer so they dont create multiple accounts.
"sirfunusa" wrote in message
news:1143831159.822811.53220@u72g2000cwu.googlegroups.com...
> You did not read and apply what others have told you. You can never
> rely on getting the ip address anyway. AOL users for example, always
> will show the same IP, since they go through a proxy. What do you hope
> to do with the IP? Hopefully nothing as naive as user personalization
> or similar.
>
> Create a one-line test.aspx with the following:
>
> <% Response.Write (Request.ServerVariables("REMOTE_HOST")) %>
>
Re: How do you get the IP address of a computer using ASP.net?
am 01.04.2006 22:15:25 von Mark Rae
"Progman" wrote in message
news:NlyXf.27305$F84.925820@weber.videotron.net...
> I hope to identify the users computer so they dont create multiple
> accounts.
LOL! Have you *really* not got it yet...? You can't rely on the IP address
to identify a computer. For one thing, lots of people are still using
dial-up, so their IP address is almost 100% *guaranteed* to be different
every time they connect to the internet - that's what the 'D' in DHCP
means...
Also, what's to stop someone from going to their neighbour's house and
creating another account from there? Or visiting an Internet cafe? Or...?
Re: How do you get the IP address of a computer using ASP.net?
am 03.04.2006 18:30:58 von sirfunusa
Of course REMOTE_HOST will work. Did you try it? But YOU CANNOT get the
user's IP address reliably. End of story.
Re: How do you get the IP address of a computer using ASP.net?
am 04.04.2006 05:39:31 von VickZaro
see my responses
"Mark Rae" wrote in message
news:OpYzDkcVGHA.1160@TK2MSFTNGP09.phx.gbl...
> "Progman" wrote in message
> news:NlyXf.27305$F84.925820@weber.videotron.net...
>
>> I hope to identify the users computer so they dont create multiple
>> accounts.
>
> LOL! Have you *really* not got it yet...? You can't rely on the IP address
> to identify a computer. For one thing, lots of people are still using
> dial-up, so their IP address is almost 100% *guaranteed* to be different
but the proportion of people using cable increase and will be soon the
majority
> every time they connect to the internet - that's what the 'D' in DHCP
> means...
so I will put in the instructions, make sure your system is a same ip
address
simple...
>
> Also, what's to stop someone from going to their neighbour's house and
> creating another account from there? Or visiting an Internet cafe? Or...?
they will have to have a lot of friends to create many accounts. so this
will be the minority
Re: How do you get the IP address of a computer using ASP.net?
am 04.04.2006 09:37:02 von Mark Rae
"VickZaro" wrote in message
news:TTlYf.43280$24.795945@wagner.videotron.net...
> but the proportion of people using cable increase and will be soon the
> majority
Even so, the vast majority of residential cable users are on DHCP too...
>> every time they connect to the internet - that's what the 'D' in DHCP
>> means...
>
> so I will put in the instructions, make sure your system is a same ip
> address
> simple...
ROTLFMAO! OK, then, explain to me just how you will instruct a home user on
dial-up to use the same IP address every time they connect...
Re: How do you get the IP address of a computer using ASP.net?
am 04.04.2006 20:44:36 von sirfunusa
You CANNOT do this. You post here, and have received advice from the
experts. I, for one, wrote a book on the subject. Your path is ill
advised, and a very poor solution. I would never hire you. Use a
database, and store usernames and passwords..um...like MOST other
websites! There is a reason why they do this. Use the authentication
mechanisms built into .NET
Re: How do you get the IP address of a computer using ASP.net?
am 05.04.2006 16:41:31 von webonomic
The original thread for this is here:
http://groups.google.ca/group/microsoft.public.dotnet.framew ork.aspnet/browse_thread/thread/8cec57fff4f96573/a73ff8a2b1d 29038?lnk=st&q=IP+address+of+a+computer+using+ASP.net&rnum=2 &hl=en#a73ff8a2b1d29038
Progman, in your first thread, people gave you the answer. I don't
want to offend you, but if you haven't figured it out, you shouldn't be
programming. Also, a quick and easy search on Google for "Asp.Net get
IP address" or something similar will reveal some good results to tell
you how to get the IP address. What you seem to want is someone to
write the code for you. Typically these groups provide paths to the
answer, you have to walk it yourself.
Now in your second thread you mention "I hope to identify the users
computer so they dont create multiple accounts. "
Hopefully peoples responses made sense. It is not programmatically
possible to stop people from creating multiple accounts. Because
person A may end up with person B's IP address, if you block IP address
from making another account, you just stopped person A from creating an
account because person B already made one.
You can store a cookie on a person's machine to track them, and then
check the cookie to see if they signed up already, but most people do
not allow cookies or just delete them.
You could search for Macromedia Flash stored objects which can mimic
cookies and it is harder to delete these. You'll have to talk to a
Macromedia user group for more info on that.
Alternatively, you can take a non programming approach and have people
sign up supply you with there home address and you can "snail mail"
them a password. (You know, the non-electronic way of mailing someone
a letter). But then some people have more then one house address they
could use, so you still can't 100% know if they already have an
account.
Using all of these methods together would be your best bet.
RE: How do you get the IP address of a computer using ASP.net?
am 01.02.2008 19:53:03 von Jerry
private string GetIP()
{
string ipAddress = string.Empty;
IPHostEntry hostEntry = Dns.GetHostByName(Dns.GetHostName());
if (hostEntry.AddressList.Length != 0)
{
ipAddress = hostEntry.AddressList[0].ToString();
}
return ipAddress;
}
From http://www.developmentnow.com/g/8_2006_3_0_0_728672/How-do-y ou-get-the-IP-address-of-a-computer-using-ASP-net.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Re: How do you get the IP address of a computer using ASP.net?
am 01.02.2008 21:14:13 von mark
"Jerry" wrote in message
news:75dc6671-97e3-4293-a3fa-1eb66cbfd203@developmentnow.com ...
> From
> http://www.developmentnow.com/g/8_2006_3_0_0_728672/How-do-y ou-get-the-IP-address-of-a-computer-using-ASP-net.htm
The opening statement of that article is far more significant than the
actual code snippet:
"You did not read and apply what others have told you. You can never rely on
getting the IP address anyway. AOL users for example, always will show the
same IP, since they go through a proxy. What do you hope to do with the IP?
Hopefully nothing as naive as user personalisation or similar."
--
Mark Rae
ASP.NET MVP
http://www.markrae.net