Server IP address

Server IP address

  
Hello all,

After a user login, is the server IP address (or server host name) acessible to a application as is the userID and userName?
If no, is there a way to get it?

Thanks in advance
Hi, you won't have that info just as in userId or userName.
In fact that info is bounded to the request. The way to extract info (any other info also) that goes on the request is thru HttpRequestHandler extension, and to get the ip, you have GetIP action (Gets the IP host address of the remote client (IP of the user machine performing the HTTP request).)

Hope this helps.
Luis Lopes
I sometimes encounter problems with my IP address like i've been blocked for no reason.
I think that the OP intends to know how to get the server IP, and not the client's. If so, you can obtain it using the collection item Request.ServerVariables["LOCAL_ADDR"]; (you can easily add a function that returns it to HttpRequestHandler extension) and you should get the server ip.

Best regards,
 Tiago Martins
I don't know if this applies to whatever you're trying to acomplish, but I have sucessfully used "localhost" before to avoid the need of getting the server address, while keeping the application dynamic, ready for new environments.

Just a quick side note everyone: don't forget that on a multi-node Agile Platform installation, each request by the same user may be answered by a different node depending on how you have the load balancer set up.

Just a thought if you ever implement something that decides to store this IP somewhere... :)


Miguel
@Miguel: That was actually the reason that made me use the ServerVariable collection in the first place... to know exactly what node was performing my requests during runtime...

António Chinita wrote:

I don't know if this applies to whatever you're trying to acomplish, but I have sucessfully used "localhost" before to avoid the need of getting the server address, while keeping the application dynamic, ready for new environments.

Hi António, I would be very interested to see how you implemented this within OutSystems.


If you are a regular computer user like me, you probably don't pay attention to concepts like domains, servers, IP addresses or domain names. Perhaps you think that these phrases are for computer nerds, or for those in the Information Technology field that need to know these to keep their jobs. Maybe for you, a computer serves it purpose if you can encode files, save documents, access the internet and visit the sites that you would like to see. However, unknown to many, websites will not be around if not for the domain server. If you have ever used the internet to send an email or check a social networking site, you have used several domain servers without realizing it.

sbobet

Here's an other way to check your domain name / ip-address.

First get the URL with the action "GetURL".
(If you don't see this action, make sure you have it's reference added to your application. It can be found in the HTTPRequestHandler producer.)

Then you can use the return value of this GETURL action in an IF statement to check if a certain IP or domain name is part of it's URL.


Code Snippet IF statement

Index(GetURLName.URL,"1.1.1.1") = -1


If the IP address you are looking for is NOT part of the url it will return the value -1