1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Redirecting a URL using an ASP script

Discussion in 'C#' started by iBold, Jul 20, 2006.

  1. #1
    You'll have to excuse me, asp isn't my thing...

    Heres what I am trying to do. There is a link out there:
    /cmd.asp?af=415652&u=http://www.drdavesbest.com/fountain_of_youth.html


    and right now it leads to the page it says there at the end of the URL.

    I need it to lead to http://www.drdavesbest.com/misc/fountain_of_youth.html

    But I don't have control over the original link (it's on an affiliates website).
    SEMrush
    The existing ASP script looks something like this:
    
     if request("af")<>"" then 'aftrack
      dest=baseurl&"/app/aftrack.asp?afid="&request("af")&"&u="&request("u")
     elseif request("ad")<>"" then 'adtrack
      dest=baseurl&"/app/adtrack.asp?adid="&request("ad")
     elseif request("imp")<>"" then 'Track Impressions
      dest=baseurl&"/app/?imp="&request("imp")
     elseif request("clk")<>"" then 'Track Clicks
      dest=baseurl&"/app/?clk="&request("clk")
     elseif request("email1")<>"" then 'contact
      dest=baseurl&"/app/contactsave.asp?merchantid="&merchantid
      if request.querystring<>"" then dest=dest & "&" & request.querystring
      if request.form<>"" then dest=dest & "&" & request.form
    
    Code (markup):
    Is there an 'if' statement that I can put in there to do the redirect? What would it go? Do I need to change anything up there? Is this even possible? :) Thx!
     
    iBold, Jul 20, 2006 IP
    SEMrush
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    response.redirect request("u")

    is this what you wanted ????
     
    ludwig, Jul 21, 2006 IP
  3. iBold

    iBold Peon

    Messages:
    1,055
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, you're the second person to suggest this to me..
    How do I implement that in the above code? Thx a million for your help!
     
    iBold, Jul 21, 2006 IP
  4. Darrin

    Darrin Peon

    Messages:
    123
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I noticed that the URL that you want it to go to has a "misc" directory between the domain and the page name, but it is not there in the URL in the "u" paramter.

    Do you need to add the "misc" directory into the path when you redirect?
     
    Darrin, Jul 21, 2006 IP
  5. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #5
    could you please explain what is doing your code
     if request("af")<>"" then 'aftrack
      dest=baseurl&"/app/aftrack.asp?afid="&request("af")&"&u="&request("u")
     elseif request("ad")<>"" then 'adtrack
      dest=baseurl&"/app/adtrack.asp?adid="&request("ad")
     elseif request("imp")<>"" then 'Track Impressions
      dest=baseurl&"/app/?imp="&request("imp")
     elseif request("clk")<>"" then 'Track Clicks
      dest=baseurl&"/app/?clk="&request("clk")
     elseif request("email1")<>"" then 'contact
      dest=baseurl&"/app/contactsave.asp?merchantid="&merchantid
      if request.querystring<>"" then dest=dest & "&" & request.querystring
      if request.form<>"" then dest=dest & "&" & request.form
    Code (markup):
    i think you need to do the following:
    
    response.redirect dest
    response.end
    
    Code (markup):
    or you need to do the following
    
    response.redirect request.querystring("u")
    response.end
    
    Code (markup):
    I am not sure what is your code for
    you need to add the above lines at the very end of your document
     
    ludwig, Jul 21, 2006 IP
  6. iBold

    iBold Peon

    Messages:
    1,055
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The code is to determine which affiliate gets credit for the link, then redirect them to the proper page. Depending on the URL string they come from, a different action is assigned.
     
    iBold, Jul 21, 2006 IP
  7. Postingpays

    Postingpays Well-Known Member

    Messages:
    1,072
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    185
    #7
    This is very simple, You only need to write the redirection code. Syntax for it is.

    Response.redirect("Abc.html"). In your case. if we apply redrirection it wil become

    if request("af")<>"" then 'aftrack
    dest=baseurl&"/app/aftrack.asp?afid="&request("af")&"&u="&request("u")
    response.redirect(dest)
    elseif request("ad")<>"" then 'adtrack
    dest=baseurl&"/app/adtrack.asp?adid="&request("ad")
    response.redirect(dest)

    elseif request("imp")<>"" then 'Track Impressions

    dest=baseurl&"/app/?imp="&request("imp")
    response.redirect(dest)

    elseif request("clk")<>"" then 'Track Clicks
    dest=baseurl&"/app/?clk="&request("clk")
    response.redirect(dest)

    elseif request("email1")<>"" then 'contact
    dest=baseurl&"/app/contactsave.asp?merchantid="&merchantid
    response.redirect(dest)

    Hope it helps you..
     
    Postingpays, Aug 15, 2006 IP