/// -----------------------------------------------------------------------------
        /// <summary>
        /// 
        /// </summary>
        /// <remarks>
        /// - manage affiliates
        /// - log visit to site
        /// </remarks>
        /// <history>
        /// 	[sun1]	1/19/2004	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void ManageRequest()
        {
            //affiliate processing
            int affiliateId = -1;
            if (Request.QueryString["AffiliateId"] != null)
            {
                if (Regex.IsMatch(Request.QueryString["AffiliateId"], "^\\d+$"))
                {
                    affiliateId = Int32.Parse(Request.QueryString["AffiliateId"]);
                    var objAffiliates = new AffiliateController();
                    objAffiliates.UpdateAffiliateStats(affiliateId, 1, 0);

                    //save the affiliateid for acquisitions
                    if (Request.Cookies["AffiliateId"] == null) //do not overwrite
                    {
                        var objCookie = new HttpCookie("AffiliateId");
                        objCookie.Value = affiliateId.ToString();
                        objCookie.Expires = DateTime.Now.AddYears(1); //persist cookie for one year
                        Response.Cookies.Add(objCookie);
                    }
                }
            }

            //site logging
            if (PortalSettings.SiteLogHistory != 0)
            {
                //get User ID

                //URL Referrer
                string urlReferrer = "";
                try
                {
                    if (Request.UrlReferrer != null)
                    {
                        urlReferrer = Request.UrlReferrer.ToString();
                    }
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);

                }
                string strSiteLogStorage = Host.SiteLogStorage;
                int intSiteLogBuffer = Host.SiteLogBuffer;

                //log visit
                var objSiteLogs = new SiteLogController();

                UserInfo objUserInfo = UserController.GetCurrentUserInfo();
                objSiteLogs.AddSiteLog(PortalSettings.PortalId, objUserInfo.UserID, urlReferrer, Request.Url.ToString(),
                                       Request.UserAgent, Request.UserHostAddress, Request.UserHostName,
                                       PortalSettings.ActiveTab.TabID, affiliateId, intSiteLogBuffer,
                                       strSiteLogStorage);
            }
        }
        /// <remarks>
        /// - manage affiliates
        /// - log visit to site
        /// </remarks>
        /// <history>
        /// 	[sun1]	1/19/2004	Created
        /// </history>
        private void ManageRequest()
        {
            // affiliate processing
            int AffiliateId = - 1;
            if( Request.QueryString["AffiliateId"] != null )
            {                
                if( Int32.TryParse(Request.QueryString["AffiliateId"], out AffiliateId ) )
                {
                    AffiliateId = int.Parse( Request.QueryString["AffiliateId"] );
                    AffiliateController objAffiliates = new AffiliateController();
                    objAffiliates.UpdateAffiliateStats( AffiliateId, 1, 0 );

                    // save the affiliateid for acquisitions
                    if( Request.Cookies["AffiliateId"] == null ) // do not overwrite
                    {
                        HttpCookie objCookie = new HttpCookie( "AffiliateId" );
                        objCookie.Value = AffiliateId.ToString();
                        objCookie.Expires = DateTime.Now.AddYears( 1 ); // persist cookie for one year
                        Response.Cookies.Add( objCookie );
                    }
                }
            }

            // site logging
            if( PortalSettings.SiteLogHistory != 0 )
            {
                // get User ID

                // URL Referrer
                string URLReferrer = "";
                if( Request.UrlReferrer != null )
                {
                    URLReferrer = Request.UrlReferrer.ToString();
                }

                string strSiteLogStorage = "D";
                if( Convert.ToString( Globals.HostSettings["SiteLogStorage"] ) != "" )
                {
                    strSiteLogStorage = Convert.ToString( Globals.HostSettings["SiteLogStorage"] );
                }
                int intSiteLogBuffer = 1;
                if( Convert.ToString( Globals.HostSettings["SiteLogBuffer"] ) != "" )
                {
                    intSiteLogBuffer = int.Parse( Convert.ToString( Globals.HostSettings["SiteLogBuffer"] ) );
                }

                // log visit
                SiteLogController objSiteLogs = new SiteLogController();

                UserInfo objUserInfo = UserController.GetCurrentUserInfo();
                objSiteLogs.AddSiteLog( PortalSettings.PortalId, objUserInfo.UserID, URLReferrer, Request.Url.ToString(), Request.UserAgent, Request.UserHostAddress, Request.UserHostName, PortalSettings.ActiveTab.TabID, AffiliateId, intSiteLogBuffer, strSiteLogStorage );
            }
        }