All pastes #959157 Raw Edit

Miscellany

public text v1 · immutable
#959157 ·published 2008-03-27 05:15 UTC
rendered paste body
using System;
using System.Net;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DbDownload
{
    public partial class DbDownloadForm : Form
    { 

        public DbDownloadForm()
        {
            InitializeComponent();
        }

        private void downloadButton_Click(object sender, EventArgs e)
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback (IgnoreCertificateErrorHandler);

            WebClient engineer = new WebClient();
            WebClient codes = new WebClient();
            try
            {
                engineer.DownloadFile("https://bridge.compucom.com/content_upload/largefiles/Airtime/engineer/engineer.mdb", "C:\\Program Files\\CompuCom AIRTime\\engineer.mdb");
                codes.DownloadFile("https://bridge.compucom.com/content_upload/largefiles/Airtime/engineer/codes.mdb", "C:\\Program Files\\CompuCom AIRTime\\codes.mdb");
            engineerLabel.Text = "Downloaded";
            codesLabel.Text = "Downloaded";
            }
            catch(Exception q)
            {
                MessageBox.Show("Error. Please try again.\n" + q, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                engineerLabel.Text = "Error";
                codesLabel.Text = "Error";
            }
        }

        private void DbDownloadForm_Load(object sender, EventArgs e)
        {
            this.ControlBox = true;

        }

        private void exitButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private bool IgnoreCertificateErrorHandler(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
    }
}