Hi,
I recently purchased hosting using ASP, since moving on from PHP. Dont ask why, I dont know, but I have bought it now.
I was using a php script that used URL forwarding, it looked like this:
<?
$linkid = $_GET['linkid'];
if ($linkid == "1") {$link = "site.com";}
header("Location: $link");
exit();
?>
Does anyone know of a similar code using ASP instead of PHP?
Thanks
Terry
Ok thanks.
I cannot fine tune it, I'm pretty decent with PHP but cannot get the asp to work.
I have tried:
linkid = Request.QueryString("linkid")
If linkid = 1 Then link = "site.com"
Response.Redirect(link)
Saved it as go.asp
How would I like to it?
With PHP it was go.php?linkid=1
Thanks again
Terry
first you need to confirm whether it's ASP/ASPX, and what language you are using, as you can use javascript, VB Script, C# as your script language.
Assuming regular VBScript driven ASP, then at the top of the redirect file:
eg. go.asp
call it with go.asp?linkid=1PHP Code:<%
linkid = Request.QueryString("linkid")
If linkid = 1 Then link = "http://site.com"
Response.Redirect(link)
%>
There's more elegant ways, by using SWITCH...CASE etc. but that's the basic, for sure.
Steve
The above code would fail if linkid is anything other than 1 - the code would try to redirect to something that isn't a url. Should be
If linkid = 1 Then
link = "http://site.com"
Response.Redirect(link)
end if
Usually for redirects we'd use a select case,
linkid = Request.QueryString("linkid")
select case linkid
case 1
response.redirect "http://site.com"
case 2
response.redirect "http://othersite.com"
...etc..
Hi Tezza,
I was just pouring a glass of
Stowells White Christmas wine
whilst purusing the post titles.
I passively read yours out aloud
to which (totally un-prompted) one
of my code geeks replied;
"Sounds like a bad idea to me..."
If you would like me to sober him
up and get him to elaborate, please
let me know...
Affi New Year
Thank you for the replies, I am on a different Laptop now (my daughters) so I shall try that tomorrow.
Unfortunatly coding is not a strength of mine, although I make up for it on SEO and ideas, at least I try, hehe.
I changed to ASP.net hosting because I wanted to try a shopping.com API script that I have found, but it means me now transfering 30+ domainsSilly mistake! I guess I was tired when I did it
. I could still use URL masking too, I suppose that is another way around it. I only get multi domain hosting for 6 months anyway so maybe will swap back when it is time to expire.
Dont get too drunk Affi, save the hangovers for xmasNothing worse than trying to think on a hangover
JonSP, luckily I use only 1 referral URL per landing page/domain, at least on most of my sites I do, so I guess that should be okay? Its just that on one or two sites I use more than 1 deep link.
Thanks again guys, help is much appreciated.
Terry
Hi Terry
Can you not use a masked redirect so the URL never changes.
Or just a frame, although G will still spider all pages without.. (Idea : You could write a very quick "If no frame then grab frame script", literally about 4 lines of code.)
Hope this helps.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks