📄 paymentauthextension.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Services.Protocols;
public class PaymentAuthExtension : SoapExtension
{
public override void ProcessMessage(SoapMessage message)
{
if (message.Stage == SoapMessageStage.AfterDeserialize)
{
//Check for an SoapPaymentHeader containing valid credit card information
foreach (SoapHeader header in message.Headers)
{
if (header is SoapPaymentHeader)
{
SoapPaymentHeader paymentHeader = (SoapPaymentHeader)header;
if (paymentHeader.CreditCardNumber.Length != 0 && paymentHeader.NameOnCard.Length != 0)
return; // Allow call to execute
break;
}
}
// Throw an exception if we get here
throw new SoapException("Invalid credit card information", SoapException.ClientFaultCode);
}
}
public override Object GetInitializer(Type type)
{
return GetType();
}
public override Object GetInitializer(LogicalMethodInfo info, SoapExtensionAttribute attribute)
{
return null;
}
public override void Initialize(Object initializer)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -