【发布时间】:2010-03-10 08:03:51
【问题描述】:
我在 ; 处不断收到 null 异常。以下。 ApiUsername 和 ApiPassword 有值,所以我不明白我只是设置错了还是什么。 Credentials 属性是某种类型,它具有需要设置的 Username 和 Password 属性。
所以我定义了自动属性: 公共 CustomSecurityHeaderType SoapCallCredentials { 获取;私人套装; }
然后,每当遇到此问题时,我都会收到一个 null 异常并且无法弄清楚原因。
private void SetApiCredentials()
{
SoapCallCredentials = new CustomSecurityHeaderType
{
Credentials =
{
Username = PayPalConfig.CurrentConfiguration.ApiUserName,
Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
};
UrlEndPoint = PayPalConfig.CurrentConfiguration.ExpressCheckoutSoapApiEndPoint;
}
【问题讨论】:
-
您的凭据声明中是否缺少
new? -
我是这么想的,但让我再试一次。
标签: c# properties