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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to 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.



Sponsored Link
Ads by Google

Response Number 1
Name: rolica
Date: July 9, 2009 at 19:01:25 Pacific
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 %>


1

Response Number 2
Name: Bungle
Date: September 30, 2009 at 11:01:34 Pacific
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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


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