Example #1
0
    public void ProxyTest()
    {
        var proxyTester = new ProxyTester(new CredentialStore());

        Assert.IsTrue(proxyTester.TestCredentials(CredentialCache.DefaultCredentials));
        Assert.IsTrue(proxyTester.TestCredentials(CredentialCache.DefaultNetworkCredentials));
    }
Example #2
0
    void OkClick(object sender, RoutedEventArgs e)
    {
        var credentials = new NetworkCredential(username.Text, password.Password);

        if (proxyTester.TestCredentials(credentials))
        {
            credentialStore.Credentials = credentials;
            if (saveCredentials.IsChecked.GetValueOrDefault(false))
            {
                SavedCredentials.SaveCredentials(username.Text, password.SecurePassword);
            }
            Close();
        }
        else
        {
            MessageBox.Show(this, "The supplied username and password were not accepted by the proxy server", "Credentials failed", MessageBoxButton.OK, MessageBoxImage.Error);
        }
    }