The user offers up many environment variables without even knowing it. You can learn a LOT about these variables by running the following script:
<table> <% for each x in Request.ServerVariables Response.Write("<tr><td>" & x & "</td><td>") Response.Write(Request.ServerVariables(x)) Response.Write("</td></tr>" & vbCrLf) next %> </table> |
Here is a JScript equivalent:
<table> <script language='JScript' runat=server> var svColl = Request.ServerVariables(); for(sv = new Enumerator(svColl); !sv.atEnd(); sv.moveNext()) { var nm = sv.item(); Response.Write("<tr><td>" + nm + "</td><td>"); Response.Write(svColl(nm) + "</td></tr>"); } </script> </table> |
Note that in the case of the user's IP address, which is stored in the REMOTE_ADDR variable, this value isn't reliable. Anyone behind a proxy / firewall will reflect the IP address of the proxy rather than their own machine, so people at big companies can all appear to be the same user. This case is even more significant with AOL, which has a very limited set of IP addresses representing their entire user base of millions. The best form of unique idenitification is going to involve sessions (short-term) or cookies (repeat visits), if the user accepts cookies. Over the long term, you can store a GUID, IDENTITY value, or something else that will uniquely identify this user in the future, in a database. Keep in mind that the user can, at any time, delete their cookies. So if their information is important, you might also provide some way for them to re-establish their cookie through a login mechanism.