Computing.Net > Forums > Web Development > ASP Code question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

ASP Code question

Reply to Message Icon

Name: Bungle
Date: June 1, 2009 at 09:10:53 Pacific
OS: XP
CPU/Ram: Unknown
Subcategory: General
Comment:

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.




Response Number 1
Name: rolica
Date: July 9, 2009 at 19:01:25 Pacific
+1
Reply:

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



Response Number 2
Name: Bungle
Date: September 30, 2009 at 11:01:34 Pacific
+1
Reply:

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.



Reply to Message Icon

Related Posts

See More


.net app problem Myspace/Google Search



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Google Ads



Results for: ASP Code question

Asp code www.computing.net/answers/webdevel/asp-code/176.html

Date pop-up box in ASP.NET www.computing.net/answers/webdevel/date-popup-box-in-aspnet/833.html

ASP error 80070520 www.computing.net/answers/webdevel/asp-error-80070520/879.html