Beispiel #1
0
    protected override void OnInit(EventArgs e)
    {
        if (string.IsNullOrEmpty(CommonLogic.QueryStringCanBeDangerousContent("d")))
        {
            HttpResponseHelper.RespondWithFileNotFound(Response);
            return;
        }

        //removed the binding of event to the html and code it here for mobile
        txtCaptcha.TextChanged += txtCaptcha_TextChanged;
        btnDownload.Click      += btnDownload_Click;
        btnDownload.Text        = "Download";

        ThisCustomer.RequireCustomerRecord();
        //Make sure the current customer is logged in.
        if (ThisCustomer.IsNotRegistered)
        {
            RedirectNonRegisteredUser();
        }
        else
        {
            // get the querystring for the download id
            string strDownloadId = CommonLogic.QueryStringCanBeDangerousContent("d");
            // get the querystring for the order id
            string orderId = CommonLogic.QueryStringCanBeDangerousContent("sid");

            if (InterpriseHelper.IsCorrectCustomer(ThisCustomer, orderId))
            {
                //The customer is either logged in and its their download, or the customer is anonymuos and the download
                //is for an anonymous customer.
                divSignInPrompt.Visible = false;
                lblCaption.Text         = "Please enter the text on the image below";
                divDownload.Visible     = true;

                InterpriseHelper.ClearCustomerDownloadableLinkFromSession(ThisCustomer);

                if (!IsPostBack)
                {
                    GenerateAndShowCaptchaImage();
                }
            }
            else
            {
                txtCaptcha.Visible  = false;
                btnDownload.Visible = false;
                lblError.Text       = "You are not allowed to download this file since this belongs to a different customer!";
            }
        }

        base.OnInit(e);
    }