System.Net and NAT

S

Seth Anderson

Somewhere buried in the System.Net namespace is a call or method that I
really need that I cannot find. Most computers on the Internet these days go
through NAT, where an private intranet address (192.168.x.x) gets translated
through NAT and becomes visible on the Internet. My entire home network uses
NAT, so I'm well versed in NAT on that end. My problem is with my web
application. Because of it rather complex model, two computers connecting
with the same public IP address get their data muddled between requests. I
can get the public IP address easily, through the Request object, but how do
I get the private IP address? It is the one way I can uniquely identify
connecting computers, because even if they share the same public IP address,
they cannot share the same private IP address.

Any help is appreciated.

Thank you kindly,

Seth Anderson
 
J

Jon Skeet

Seth Anderson said:
Somewhere buried in the System.Net namespace is a call or method that I
really need that I cannot find. Most computers on the Internet these days go
through NAT, where an private intranet address (192.168.x.x) gets translated
through NAT and becomes visible on the Internet. My entire home network uses
NAT, so I'm well versed in NAT on that end. My problem is with my web
application. Because of it rather complex model, two computers connecting
with the same public IP address get their data muddled between requests. I
can get the public IP address easily, through the Request object, but how do
I get the private IP address? It is the one way I can uniquely identify
connecting computers, because even if they share the same public IP address,
they cannot share the same private IP address.

Any reason for not using cookies in conjunction with the IP address?
 
J

Jon Skeet

Seth Anderson said:
Personally, I don't like cookies and never have. I have tried the
'cookieless' route, but that is incompatible with my application's design.

The application handles variables (Request.QueryString and Request.Form
objects) in a rather unorthodox way. All variables that are received from
the client are stored in the database during a call and are either removed
or updated on the next call. Which is why two computers connecting that use
the same public IP address get muddled. Once I gain access to the private IP
address (somehow), this last problem will go away.

Okay, here's another cookieless solution: on the first request,
generate a unique id. Include that as a URL parameter of every
subsequent request. (You identify a "first request" as one without a
unique id). That way you can also manage multiple sessions from the
same computer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top