<%@ Page Language="VB" %>
<%
'! Tradetracker Redirect-Page.
' Set domain name on which the redirect-page runs, WITHOUT "www.".
Dim domainName As String = "vakantieparkgiethoorn.nl"
' Set the P3P compact policy.
Response.AddHeader("P3P", "CP=""ALL PUR DSP CUR ADMi DEVi CONi OUR COR IND""")
' Define parameters.
Dim campaignID, materialID, affiliateID, redirectURL, reference As String
Dim canRedirect As Boolean = true
' Set parameters.
If Request.QueryString("campaignID") <> "" Then
campaignID = Request.QueryString("campaignID")
materialID = Request.QueryString("materialID")
affiliateID = Request.QueryString("affiliateID")
redirectURL = Request.QueryString("redirectURL")
Else If Request.QueryString("tt") <> "" Then
Dim trackingData As Array = Split(Request.QueryString("tt"), "_")
Dim parameterCount As Integer = Ubound(trackingData)
If parameterCount >= 0 Then
campaignID = trackingData(0)
If parameterCount >= 1 Then
materialID = trackingData(1)
If parameterCount >= 2 Then
affiliateID = trackingData(2)
If parameterCount >= 3 Then
reference = trackingData(3)
End If
End If
End If
End If
redirectURL = Request.QueryString("r")
Else
canRedirect = false
End If
If canRedirect = true Then
' Calculate MD5 checksum.
Dim checkSum As String = FormsAuthentication.HashPasswordForStoringInConfigFile("CHK_" + campaignID + "::" + materialID + "::" + affiliateID + "::" + reference, "MD5")
' Calculate unix time stamp.
Dim timeStamp As String = CInt(DateTime.Now.ToUniversalTime().Subtract(New DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds)
' Set session/cookie arguments.
Dim cookieName As String = "TT2_" + campaignID
Dim cookieValue As String = materialID + "::" + affiliateID + "::" + reference + "::" + checkSum + "::" + timeStamp
' Set session data.
Session.Add(cookieName, cookieValue)
' Create tracking cookie.
Response.Cookies(cookieName).Value = cookieValue
Response.Cookies(cookieName).Expires = DateTime.Now.AddDays(365)
If domainName <> "" Then
Response.Cookies(cookieName).Domain = "." + domainName
End If
Response.Cookies(cookieName).Path = "/"
' Set trackBackURL.
Dim trackBackURL As String = "https://tc.tradetracker.net/?c=" + campaignID + "&m=" + materialID + "&a=" + affiliateID + "&r=" + Server.URLEncode(reference) + "&u=" + Server.URLEncode(redirectURL)
' Redirect to TradeTracker.
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", trackBackURL)
Response.End
End If
%>