Steve Lynch wrote on 03 mei 2006 in
microsoft.public.inetserver.asp.general:
Is there a way to display the server's host name or computer name from
ASP when the page was accessed by IP address? I tried dumping all the
variables and header information, but when the URL is accessed using
the IP address, the variables like SERVER_NAME and HTTP_HOST are sent
to the web browser as the IP address.
"Display" in the sense of "display in the address bar"?
<%
If Request.ServerVariables("SERVER_NAME") = "123.456.789.123" Then
Response.Redirect "http://www.myDomainByName.xyz" &_
Request.ServerVariables("PATH_INFO")
End If
%>
or perhaps:
<%
If Request.ServerVariables("SERVER_NAME") =_
Request.ServerVariables("LOCAL_ADDR") Then
Response.Redirect "http://www.myDomainByName.xyz" &_
Request.ServerVariables("PATH_INFO")
End If
%>
Not tested!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)