protected void btnSetPPStandard_Click(object sender, EventArgs e)
    {
        // Get the current configuration file.
        System.Configuration.Configuration config  = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        PayPalStandardSettings             section = (PayPalStandardSettings)config.GetSection("PayPalStandardSettings");

        try {
            if (section != null)
            {
                section.UseSandbox    = chkUsePPStandardSandbox.Checked;
                section.BusinessEmail = txtBusinessEmail.Text;
                section.PDTID         = txtPDTID.Text;
                section.IsActive      = chkUsePPStandard.Checked;
                config.Save();
                ResultMessage2.ShowSuccess("PayPal Standard Settings Saved");
            }
            else
            {
                throw new Exception("There is no PayPalStandardSettings section in the Web.Config");
            }
        }
        catch (Exception x) {
            ResultMessage2.ShowFail("Cannot write to the Web.Config file; in order to have the application update the configuration, you have to allow write access to the ASNET account (or NETWORK SERVICE) and make sure the file is not marked as Read Only");
        }
    }
示例#2
0
 public static void Load()
 {
     // Get the current configuration file.
     System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
     generalSettings    = (GeneralSettings)config.GetSection("GeneralSettings");
     ppProSettings      = (PayPalProSettings)config.GetSection("PayPalProSettings");
     ppStandardSettings = (PayPalStandardSettings)config.GetSection("PayPalStandardSettings");
     CreditCardSettings = (PaymentServiceSection)config.GetSection("PaymentService");
     TaxServiceSettings = (TaxServiceSection)config.GetSection("TaxService");
     shippingSettings   = (FulfillmentServiceSection)config.GetSection("FulfillmentService");
 }