private void btnOk_Click(object sender, EventArgs e)
    {
        // Prepare the settings
        var exportSettings = new SiteExportSettings(MembershipContext.AuthenticatedUser)
        {
            WebsitePath = Server.MapPath("~/"),
            TargetPath  = GetTargetFolder()
        };

        // Initialize
        ImportExportHelper.InitSingleObjectExportSettings(exportSettings, ExportedObjectInfo);

        string result = ImportExportHelper.ValidateExportFileName(exportSettings, txtFileName.Text);

        // Filename is valid
        if (!String.IsNullOrEmpty(result))
        {
            ShowError(result);
        }
        else
        {
            string fileName = txtFileName.Text.Trim();

            // Add extension
            if (Path.GetExtension(fileName).ToLowerCSafe() != ".zip")
            {
                fileName = fileName.TrimEnd('.') + ".zip";
            }
            txtFileName.Text = fileName;

            // Set the filename
            lblResult.Text = String.Format(GetString("ExportObject.ExportProgress"), ExportedObjectDisplayName);
            exportSettings.TargetFileName = txtFileName.Text;

            pnlContent.Visible    = true;
            pnlDetails.Visible    = false;
            btnOk.Enabled         = false;
            ucActivityBar.Visible = true;

            try
            {
                // Export the data
                ScriptHelper.RegisterStartupScript(this, typeof(string), "StartTimer", "StartTimer();", true);

                ucAsyncControl.RunAsync(p => ExportSingleObject(exportSettings), WindowsIdentity.GetCurrent());
            }
            catch (Exception ex)
            {
                DisplayError(ex);
            }
        }
    }
    private void btnOk_Click(object sender, EventArgs e)
    {
        // Init the Mimetype helper (required for the export)
        MimeTypeHelper.LoadMimeTypes();

        // Prepare the settings
        ExportSettings = new SiteExportSettings(CMSContext.CurrentUser);

        ExportSettings.WebsitePath = Server.MapPath("~/");
        ExportSettings.TargetPath  = targetFolder;

        // Initialize
        ImportExportHelper.InitSingleObjectExportSettings(ExportSettings, exportObj);

        string result = ImportExportHelper.ValidateExportFileName(ExportSettings, txtFileName.Text);

        // Filename is valid
        if (!string.IsNullOrEmpty(result))
        {
            lblError.Text = result;
        }
        else
        {
            txtFileName.Text = txtFileName.Text.Trim();

            // Add extension
            if (Path.GetExtension(txtFileName.Text).ToLowerCSafe() != ".zip")
            {
                txtFileName.Text = txtFileName.Text.TrimEnd('.') + ".zip";
            }

            // Set the filename
            lblProgress.Text = string.Format(GetString("ExportObject.ExportProgress"), ResHelper.LocalizeString(exportObjectDisplayName));
            ExportSettings.TargetFileName = txtFileName.Text;

            pnlContent.Visible  = false;
            pnlDetails.Visible  = false;
            btnOk.Enabled       = false;
            pnlProgress.Visible = true;

            try
            {
                // Export the data
                ltlScript.Text = ScriptHelper.GetScript("StartTimer();");
                ucAsyncControl.RunAsync(ExportSingleObject, WindowsIdentity.GetCurrent());
            }
            catch (Exception ex)
            {
                DisplayError(ex);
            }
        }
    }