Beispiel #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 Insert(Int32 actor_id, Int32 scope_id, String available, DateTime?created, Int32 created_by, DateTime?last_modified, Int32 last_modified_by, Int32 mark_as_delete, Int32 log_action_id, Int32 content_type_id, Int32 reference_id)
        {
            ActorID        = actor_id;
            ScopeID        = scope_id;
            Available      = available;
            Created        = created;
            CreatedBy      = created_by;
            LastModified   = last_modified;
            LastModifiedBy = last_modified_by;
            MarkAsDelete   = mark_as_delete;
            LogActionID    = log_action_id;
            ContentTypeID  = content_type_id;
            ReferenceID    = reference_id;
            IPAddress      = LogUtilities.GetIPAddress();

            LogID = Convert.ToInt32(container.Insert());
        }