protected void Page_Load( Object sender, EventArgs e )
        {
            try
            {
                if( ( Request.QueryString["vendorid"] != null ) && ( Request.QueryString["bannerid"] != null ) )
                {
                    int intVendorId = int.Parse( Request.QueryString["vendorid"] );
                    int intBannerId = int.Parse( Request.QueryString["bannerid"] );

                    string strURL = "~/" + Globals.glbDefaultPage;

                    BannerController objBanners = new BannerController();
                    BannerInfo objBanner = objBanners.GetBanner( intBannerId, intVendorId, PortalSettings.PortalId );
                    if( objBanner == null )
                    {
                        //Try a Host Banner
                        objBanner = objBanners.GetBanner( intBannerId, intVendorId, Null.NullInteger );
                    }
                    if( objBanner != null )
                    {
                        if( ! Null.IsNull( objBanner.URL ) )
                        {
                            strURL = Globals.LinkClick( objBanner.URL, - 1, - 1, false );
                        }
                        else
                        {
                            VendorController objVendors = new VendorController();
                            VendorInfo objVendor = objVendors.GetVendor( objBanner.VendorId, PortalSettings.PortalId );
                            if( objVendor == null )
                            {
                                //Try a Host Vendor
                                objVendor = objVendors.GetVendor( objBanner.VendorId, Null.NullInteger );
                            }
                            if( objVendor != null )
                            {
                                if( !String.IsNullOrEmpty(objVendor.Website) )
                                {
                                    strURL = Globals.AddHTTP( objVendor.Website );
                                }
                            }
                        }
                    }
                    else
                    {
                        if( Request.UrlReferrer != null )
                        {
                            strURL = Request.UrlReferrer.ToString();
                        }
                    }

                    objBanners.UpdateBannerClickThrough( intBannerId, intVendorId );

                    Response.Redirect( strURL, true );
                }
            }
            catch( Exception exc ) //Page failed to load
            {
                Exceptions.ProcessPageLoadException( exc );
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //exit without incrementing count if page is indexed by crawler
            if (Request.Browser.Crawler)
            {
                return;
            }
            try
            {
                if ((Request.QueryString["vendorid"] != null) && (Request.QueryString["bannerid"] != null))
                {
                    int intVendorId = -1;
                    if (Regex.IsMatch(Request.QueryString["vendorid"], "^\\d+$"))
                    {
                        intVendorId = int.Parse(Request.QueryString["vendorid"]);
                    }
                    int intBannerId = -1;
                    if (Regex.IsMatch(Request.QueryString["bannerid"], "^\\d+$"))
                    {
                        intBannerId = int.Parse(Request.QueryString["bannerid"]);
                    }
                    int intPortalId = -1;
                    if ((Request.QueryString["portalid"] != null))
                    {
                        if (Regex.IsMatch(Request.QueryString["portalid"], "^\\d+$"))
                        {
                            intPortalId = int.Parse(Request.QueryString["portalid"]);
                        }
                    }
                    else
                    {
                        intPortalId = Globals.GetPortalSettings().PortalId;
                    }
                    if (intBannerId != -1 && intVendorId != -1 && intPortalId != -1)
                    {
                        string strURL = "~/" + Globals.glbDefaultPage;

                        var objBanners = new BannerController();
                        BannerInfo objBanner = objBanners.GetBanner(intBannerId);
                        if (objBanner != null)
                        {
                            if (objBanners.IsBannerActive(objBanner))
                            {
                                if (!Null.IsNull(objBanner.URL))
                                {
                                    strURL = Globals.LinkClick(objBanner.URL, -1, -1, false);
                                }
                                else
                                {
                                    var objVendors = new VendorController();
                                    VendorInfo objVendor = objVendors.GetVendor(objBanner.VendorId, intPortalId);
                                    if (objVendor == null)
                                    {
                                        objVendor = objVendors.GetVendor(objBanner.VendorId, Null.NullInteger);
                                    }
                                    if (objVendor != null)
                                    {
                                        if (!String.IsNullOrEmpty(objVendor.Website))
                                        {
                                            strURL = Globals.AddHTTP(objVendor.Website);
                                        }
                                    }
                                }
                                objBanners.UpdateBannerClickThrough(intBannerId, intVendorId);
                            }
                        }
                        else if (Request.UrlReferrer != null)
                        {
                            strURL = Request.UrlReferrer.ToString();
                        }
                        Response.Redirect(strURL, true);
                    }
                }
            }
            catch (Exception exc) //Page failed to load
            {
                Exceptions.ProcessPageLoadException(exc);
            }
        }