The full URL to a page comes in three parts: The domain name, the path to the file then the filename, and the QueryString. For example, take the URL http://www.example.com/example/page.asp?name=Bob. The three parts of this are:
1. The domain name: www.example.com
2. The path to the page: /example/page.asp
3. The QueryString: name=Bob
So how do you find it all out with your own scripts?
Well the following code should do it:
<%@language="VBScript"%>
<%
Dim strDomain, strPath, strQueryString, strURL
‘ find out the domain:
strDomain = Request.ServerVariables("HTTP_HOST")
‘ find out the path to the current file:
strPath = Request.ServerVariables("URL")
‘ find out the QueryString:
strQueryString = Request.ServerVariables("QUERY_STRING")
‘ put it all together:
strURL = "http://" & strDomain & strPath & "?" & strQueryString
Response.Write "The current URL is: " & strURL
%>
How do I capure the IP address and store it only? I am building a web-based survey and I want to pass the data into the database.
Thanks,
donna