ASP Code question

June 1, 2009 at 09:10:53
Specs: XP, Unknown
Hi guys - does anyone know the code to "Read" what the current URL is in the address bar to put into an IF THEN statement. I need to show a different script depending on what page the user is currently on.

Thanks :)

I only pretend to know what I'm talking about.


See More: ASP Code question

Report •


#1
July 9, 2009 at 19:01:25
Try this:

<%
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
%>

<% If strURL="WhateverPageYouWant" then
'run this script
End If %>


Report •

#2
September 30, 2009 at 11:01:34
Sorry - I have been away for a long time, thank you for your help! :o)

I only pretend to know what I'm talking about.


Report •

Related Solutions


Ask Question