82 lines
3.3 KiB
C#
82 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Runtime.Serialization.Json;
|
|
using System.Web.SessionState;
|
|
using Dapper;
|
|
using Dapper.Contrib.Extensions;
|
|
|
|
|
|
namespace abbott_2024_event.Redirect
|
|
{
|
|
public partial class Default : System.Web.UI.Page
|
|
{
|
|
SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
string utm_source = (Request["utm_source"] == null) ? "" : Request["utm_source"].ToString();
|
|
string utm_medium = (Request["utm_medium"] == null) ? "" : Request["utm_medium"].ToString();
|
|
string uid = (Request["uid"] == null) ? "" : Request["uid"].ToString();
|
|
string phone = (Request["phone"] == null) ? "" : Request["phone"].ToString();
|
|
string username = (Request["username"] == null) ? "" : Request["username"].ToString();
|
|
|
|
if (utm_source == "") {
|
|
Response.Write("無utm_source");
|
|
Response.End();
|
|
}
|
|
|
|
string redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/2024_event/";
|
|
|
|
|
|
|
|
if (utm_medium == "prod") {
|
|
redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/2024_event/Redirect/?utm_source=" + utm_source + "&utm_medium=do_" + utm_medium + "&uid=" + uid + "&phone=" + phone + "&username=" + username;
|
|
Response.Redirect(redirectUrl);
|
|
}
|
|
|
|
if (utm_medium == "do_prod") {
|
|
redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/2024_event/";
|
|
}
|
|
|
|
if (utm_medium == "dev")
|
|
{
|
|
//redirectUrl = "https://abbott-2024-event.bremennetwork.tw/abbott-2024/";
|
|
redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/4Ip2xCJElotaBUKBNJuz9sUY5/Redirect/?utm_source=" + utm_source + "&utm_medium=do_" + utm_medium + "&uid=" + uid + "&phone=" + phone + "&username=" + username;
|
|
Response.Redirect(redirectUrl);
|
|
}
|
|
|
|
if (utm_medium == "do_dev")
|
|
{
|
|
redirectUrl = "https://www.abbott-nutrition.com.tw/pediasure/4Ip2xCJElotaBUKBNJuz9sUY5/";
|
|
}
|
|
|
|
|
|
if (utm_medium == "bremen") {
|
|
redirectUrl = "https://abbott-2024-event.bremennetwork.tw/abbott-2024/";
|
|
}
|
|
|
|
if (redirectUrl == "") {
|
|
Response.Write("無此utm_medium資料");
|
|
Response.End();
|
|
}
|
|
|
|
string temp_key = utm_source;
|
|
|
|
babyRec tmpRec = conn.QueryFirstOrDefault<babyRec>("select * from babyRec where babyRec_key = @babyRec_key", new { babyRec_key = temp_key });
|
|
|
|
if (tmpRec == null) {
|
|
Response.Write("無此temp_key資料");
|
|
Response.End();
|
|
}
|
|
|
|
|
|
redirectUrl += "?uid=" + uid + "&phone=" + phone + "&username=" + username + "&temp_key=" + temp_key +"&utm_source=" + tmpRec.utm_source + "&utm_medium=" + tmpRec.utm_medium + "&utm_campaign=" + tmpRec.utm_campaign + "&utm_content=" + tmpRec.utm_content + "&utm_term=" + tmpRec.utm_term + "&end=true";
|
|
|
|
Response.Redirect(redirectUrl);
|
|
}
|
|
}
|
|
} |