How to get IP address of the visitor browser in ASP

<%= Request.ServerVariables("REMOTE_ADDR")%>

Request.ServerVariables("REMOTE_ADDR") returns the network address visible to IIS for the current connection.

On this page — Show page sectionsHide page sections

Behind a reverse proxy, CDN or load balancer, this may be the proxy address rather than the visitor's original address. Forwarded-IP headers should only be trusted when they are set and sanitized by infrastructure you control. An IP address is also not a reliable proof of a person's identity or precise location.



In PHP we can find out the IP address and details are here.

In ASP as we will use the http header information so it is better to read the full article on http header and request object here.

We will use http header name REMOTE_ADDR or REMOTE_HOST to get the IP address. Here is the code.
<%= Request.ServerVariables("REMOTE_ADDR")%>
The above IP value ( data ) can be used for various purposes.
Referrer Cookies

Read the peer IP address

Response.Write Server.HTMLEncode( _
    Request.ServerVariables("REMOTE_ADDR"))

The result varies by visitor and network infrastructure; it may be a proxy IP address.

Proxies change what REMOTE_ADDR means

REMOTE_ADDR identifies the network peer reaching IIS, which can be a reverse proxy rather than the visitor. Only use trusted forwarding headers when your proxy configuration verifies them.

Back to top ↑


ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer