Esempio n. 1
0
        public void PerformRedirect_BeginRequest(object sender, System.EventArgs args)
        {
            // see if current URL matches any redirects
            System.Web.HttpApplication application = (System.Web.HttpApplication)sender;
            string url = application.Request.Path;                                        //get the url path -- want to grab the "/folder" from the URL and compare this to

            char last = url[url.Length - 1];                                              // make sure ends is "/"

            if (Convert.ToString(last) != "/")
            {
                url += "/";
            }

            qPtl_Redirect redirect = new qPtl_Redirect(url);

            if (redirect.RedirectID > 0)
            {
                if (!String.IsNullOrEmpty(redirect.RedirectURL))
                {
                    // add log
                    int    curr_user_id     = 0;
                    string email            = application.Context.Request.QueryString["email"];
                    string campaign         = application.Context.Request.QueryString["campaign"];
                    int    curr_campaign_id = 0;

                    // try and find a user with this email address
                    if (!String.IsNullOrEmpty(email))
                    {
                        qPtl_User user = new qPtl_User(email);

                        if (user.UserID > 0)
                        {
                            curr_user_id = user.UserID;
                        }
                    }

                    qPtl_LogAction logAction = new qPtl_LogAction("View");
                    qPtl_Log       log       = new qPtl_Log();
                    log.ActorID        = curr_user_id;
                    log.Created        = DateTime.Now;
                    log.CreatedBy      = curr_user_id;
                    log.LastModified   = DateTime.Now;
                    log.LastModifiedBy = curr_user_id;
                    log.ScopeID        = 1;
                    log.LogActionID    = logAction.LogActionID;
                    log.CampaignID     = curr_campaign_id;
                    log.ReferenceID    = redirect.RedirectID;
                    log.ReferenceData  = "Email=" + email + ", Entry URL=" + redirect.EntryURL + ", RedirectURL=" + redirect.RedirectURL + ", CampaignID=" + campaign;
                    log.IPAddress      = LogUtilities.GetIPAddress();
                    log.Insert();

                    // redirect to URL
                    (sender as HttpApplication).Response.Redirect(redirect.RedirectURL, true);
                }
            }
        }
        public void PerformRedirect_BeginRequest(object sender, System.EventArgs args)
        {
            // see if current URL matches any redirects
            System.Web.HttpApplication application = (System.Web.HttpApplication)sender;
            string url = application.Request.Path;                                          //get the url path -- want to grab the "/folder" from the URL and compare this to

            char last = url[url.Length - 1];                                              // make sure ends is "/"
            if (Convert.ToString(last) != "/")
            {
                url += "/";
            }

            qPtl_Redirect redirect = new qPtl_Redirect(url);

            if (redirect.RedirectID > 0)
            {
                if (!String.IsNullOrEmpty(redirect.RedirectURL))
                {
                    // add log
                    int curr_user_id = 0;
                    string email = application.Context.Request.QueryString["email"];
                    string campaign = application.Context.Request.QueryString["campaign"];
                    int curr_campaign_id = 0;

                    // try and find a user with this email address
                    if (!String.IsNullOrEmpty(email))
                    {
                        qPtl_User user = new qPtl_User(email);

                        if (user.UserID > 0)
                            curr_user_id = user.UserID;
                    }

                    qPtl_LogAction logAction = new qPtl_LogAction("View");
                    qPtl_Log log = new qPtl_Log();
                    log.ActorID = curr_user_id;
                    log.Created = DateTime.Now;
                    log.CreatedBy = curr_user_id;
                    log.LastModified = DateTime.Now;
                    log.LastModifiedBy = curr_user_id;
                    log.ScopeID = 1;
                    log.LogActionID = logAction.LogActionID;
                    log.CampaignID = curr_campaign_id;
                    log.ReferenceID = redirect.RedirectID;
                    log.ReferenceData = "Email=" + email + ", Entry URL=" + redirect.EntryURL + ", RedirectURL=" + redirect.RedirectURL + ", CampaignID=" + campaign;
                    log.IPAddress = LogUtilities.GetIPAddress();
                    log.Insert();

                    // redirect to URL
                    (sender as HttpApplication).Response.Redirect(redirect.RedirectURL, true);
                }
            }
        }