We can get the clients IP address using the Request object’s(The Request object retrieves the values that the client browser passed to the server during an HTTP request. ) property Request.ServerVariables Collection.
Request.ServerVariables Collection gets the values of predetermined environment variables.
“REMOTE_ADDR” gets the IP address of the remote host making the request.
ipaddr = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
here the string “ipaddr” stores the clients ip.
List Of other Request.ServerVariables Object
| Variable | Description |
|---|---|
| AUTH_TYPE | The authentication method that the server uses to validate users when they attempt to access a protected script. |
| CONTENT_LENGTH | The length of the content as given by the client. |
| CONTENT_TYPE | The data type of the content. Used with queries that have attached information, such as the HTTP queries POST and PUT. |
| GATEWAY_INTERFACE | The revision of the CGI specification used by the server. Format: CGI/revision. |
| HTTP_<HeaderName> | The value stored in the header HeaderName. Any header other than those listed in this table must be prefixed by “HTTP_” in order for the ServerVariables collection to retrieve its value. Note: The server interprets any underscore (_) characters in |
| LOGON_USER | The Windows NT® account that the user is logged into. |
| PATH_INFO | Extra path information as given by the client. You can access scripts by using their virtual path and the PATH_INFO server variable. If this information comes from a URL it is decoded by the server before it is passed to the CGI script. |
| PATH_TRANSLATED | A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping. |
| QUERY_STRING | Query information stored in the string following the question mark (?) in the HTTP request. |
| REMOTE_ADDR | The IP address of the remote host making the request. |
| REMOTE_HOST | The name of the host making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty. |
| REQUEST_METHOD | The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on. |
| SCRIPT_MAP | Gives the base portion of the URL. |
| SCRIPT_NAME | A virtual path to the script being executed. This is used for self-referencing URLs. |
| SERVER_NAME | The server’s host name, DNS alias, or IP address as it would appear in self-referencing URLs. |
| SERVER_PORT | The port number to which the request was sent. |
| SERVER_PORT_SECURE | A string that contains either 0 or 1. If the request is being handled on the secure port, then this will be 1. Otherwise, it will be 0. |
| SERVER_PROTOCOL | The name and revision of the request information protocol. Format: protocol/revision. |
| SERVER_SOFTWARE | The name and version of the server software answering the request (and running the gateway). Format: name/version. |
| URL | Gives the base portion of the URL. |
Popularity: 10% [?]

February 18th, 2009
admin
Posted in
Tags: 

Sir
I am doing project in mobile communication.I need a java program for offline&online message transfer server to server communication program
Hi Lakshmi,
I want a clear idea of your project, are you creating your own messaging server or do you need a program to send messages using a messaging server.
LOGON_USER Not working in server.please help me