Jump to content

ServerVariables


alegaddo

Recommended Posts

Hello guys !It's the first time I write on this forum and so I am grateful in advance to anyone who will help me !I need to change the OUTPUT of some ASP page by means of the country origin of the browser request (for example: if ITALY OUTPUT_#1, outside OUTPUT_#2).At the beginning I thought to the Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") but I believe in this way to obtain only the language of the browser and not the country origin.My current web hosting server supports AWStat, but unfortunately I heard no value available for ASP. :) Note: due to customer requirements, I can't force the visitor to a classic and easier registration form.Can you help me !!Many thanks

Link to comment
Share on other sites

The accept language header is probably going to be your best bet other than an IP lookup. You might want to print out all the headers and see what information you have available. The only way to do it otherwise is if you use a geolocation service to look up the location of a specific IP address. You can do a search for ASP IP geolocation to find information about that.

Link to comment
Share on other sites

  • 2 weeks later...
The accept language header is probably going to be your best bet other than an IP lookup. You might want to print out all the headers and see what information you have available. The only way to do it otherwise is if you use a geolocation service to look up the location of a specific IP address. You can do a search for ASP IP geolocation to find information about that.
Hi Justsomeguy !Thank you very much for your advice.I look for a geolocation service and I found http://geoloc.daiguo.com/about/ or http://software77.net/cgi-bin/ip-country/geo-ip.pl with db support.I prefer XML interrogation, and I wrote this <%Response.Buffer = TrueIPGeoID = Request.ServerVariables("REMOTE_ADDR") ' for example: 217.58.***Dim objXMLHTTP, xmlSet xml = Server.CreateObject("Msxml2.XMLHTTP.4.0")xml.Open "GET", "http://geoloc.daiguo.com?ip=" & IPGeoID, Falsexml.SendResponse.write xml.responseText%>Unfortunately I receive always this output: 0;;;WRONG INPUT that is:- your request has not been processed due to invalid syntax - e.g. bad IPv4 like 300.400.abc.256 - e.g. bad decimal like 2a3b4c or bigger than MAX_INTI do not understand this mistake. The query string of the script seems to be correct; I tried to enter it manually on the browser and I got the result.Can you help me ?
Link to comment
Share on other sites

  • 2 weeks later...

You might need to encode the IP to convert the periods to character codes. I'm not sure how to do that in VBScript other then by just replacing the individual characters, Javascript has the escapeURI function to do that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...