• 0

HTML page that loads based on IP or IP range??


Question

i'm working on a personal project and i'm wondering if it's possible to program HTML or XML or something that when a user accesses a website that the site looks at the source IP(which it does) and then based on that IP or IP range it sends a specific page back.

the application i am setting up in an internal web server that i want to send responses to users based on their ip's. i'd like to then set it up based on their NT user/group. being able to program a page to do this is the sticking point.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Yes, AFAIK you can do this with any of the server-side web languages, which includes CGI, PHP, JSP, ASP, ASP.NET.

For example, under ASP.NET (the one I am most familiar with), it would go something like this (incomplete):

<pre>

<% if (Request.UserHostAddress == "202.24.168.3") { %>

  <html>

    <body>

      You are 202.24.168.3!  I know you!

    </body>

  </html>

<% } else { %>

  <html>

    <body>

      Who are you?

    </body>

  </html>

<% } %>

</pre>

Obviously you could extend this to do clever things like look up their address from a table.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.