本文整理汇总了C#中RequestHandler类的典型用法代码示例。如果您正苦于以下问题:C# RequestHandler类的具体用法?C# RequestHandler怎么用?C# RequestHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestHandler类属于命名空间,在下文中一共展示了RequestHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string sp_billno = Request["order_no"];
//当前时间 yyyyMMdd
string date = DateTime.Now.ToString("yyyyMMdd");
//订单号,此处用时间和随机数生成,商户根据自己调整,保证唯一
string out_trade_no = "" + DateTime.Now.ToString("HHmmss") + WeixinPayUtil.BuildRandomStr(4);
if (null == sp_billno)
{
//生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
sp_billno = DateTime.Now.ToString("HHmmss") + WeixinPayUtil.BuildRandomStr(4);
}
else
{
sp_billno = Request["order_no"].ToString();
}
sp_billno = WeixinPayUtil.PartnerId + sp_billno;
//创建RequestHandler实例
RequestHandler packageReqHandler = new RequestHandler(Context);
//初始化
packageReqHandler.Init();
packageReqHandler.SetKey(WeixinPayUtil.Key);
//设置package订单参数
packageReqHandler.SetParameter("partner", WeixinPayUtil.PartnerId); //商户号
packageReqHandler.SetParameter("bank_type", "WX"); //银行类型
packageReqHandler.SetParameter("fee_type", "1"); //币种,1人民币
packageReqHandler.SetParameter("input_charset", "GBK");
packageReqHandler.SetParameter("out_trade_no", sp_billno); //商家订单号
packageReqHandler.SetParameter("total_fee", "1"); //商品金额,以分为单位(money * 100).ToString()
packageReqHandler.SetParameter("notify_url", WeixinPayUtil.TenpayNotify); //接收财付通通知的URL
packageReqHandler.SetParameter("body", "nativecall"); //商品描述
packageReqHandler.SetParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
//获取package包
string packageValue = packageReqHandler.GetRequestURL();
//调起微信支付签名
string timeStamp = WeixinPayUtil.GetTimestamp();
string nonceStr = WeixinPayUtil.GetNoncestr();
//设置支付参数
RequestHandler payHandler = new RequestHandler(Context);
payHandler.SetParameter("appid", WeixinPayUtil.AppId);
payHandler.SetParameter("noncestr", nonceStr);
payHandler.SetParameter("timestamp", timeStamp);
payHandler.SetParameter("package", packageValue);
payHandler.SetParameter("RetCode","0");
payHandler.SetParameter("RetErrMsg","成功");
string paySign = payHandler.CreateSHA1Sign();
payHandler.SetParameter("app_signature", paySign);
payHandler.SetParameter("sign_method","SHA1");
Response.ContentType = "text/xml";
Response.Clear();
Response.Write(payHandler.ParseXML());
}
开发者ID:hilite2000,项目名称:WeiXinMPSDK,代码行数:60,代码来源:nativecall.aspx.cs
示例2: Connect
public void Connect(string username, SecureString password, string url)
{
_requestHandler = new RequestHandler(username, password, url);
string sId = _requestHandler.Login();
var cInfo = new SessionInformation(sId, url, username);
SessionState.PSVariable.Set(SessionInfoVariableName, cInfo);
}
开发者ID:sburnicki,项目名称:ODSCmdlets,代码行数:7,代码来源:ODSCommandBase.cs
示例3: TenPayV3OrderQueryRequestData
/// <summary>
/// 查询订单 请求参数
/// </summary>
/// <param name="appId"></param>
/// <param name="mchId"></param>
/// <param name="outTradeNo"></param>
/// <param name="signType"></param>
/// <param name="key"></param>
/// <param name="transactionId"></param>
/// <param name="nonceStr"></param>
public TenPayV3OrderQueryRequestData(string appId, string mchId, string transactionId, string nonceStr,
string outTradeNo, string key, string signType = "MD5")
{
AppId = appId;
MchId = mchId;
NonceStr = nonceStr;
TransactionId = transactionId;
OutTradeNo = outTradeNo;
SignType = signType;
Key = key;
#region 设置RequestHandler
PackageRequestHandler = new RequestHandler(null);
//设置package订单参数
PackageRequestHandler.SetParameter("appid", this.AppId); //公众账号ID
PackageRequestHandler.SetParameter("mch_id", this.MchId); //商户号
PackageRequestHandler.SetParameter("transaction_id", this.TransactionId); //微信的订单号
PackageRequestHandler.SetParameter("out_trade_no", this.OutTradeNo); //商户系统内部的订单号
PackageRequestHandler.SetParameter("nonce_str", this.NonceStr); //随机字符串
Sign = PackageRequestHandler.CreateMd5Sign("key", this.Key);
PackageRequestHandler.SetParameter("sign", Sign); //签名
PackageRequestHandler.SetParameter("sign_type", this.SignType); //签名类型
#endregion
}
开发者ID:JeffreySu,项目名称:WeiXinMPSDK,代码行数:36,代码来源:TenPayV3OrderQueryRequestData.cs
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string sp_billno = Request["order_no"];
//当前时间 yyyyMMdd
string date = DateTime.Now.ToString("yyyyMMdd");
if (null == sp_billno)
{
//生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
sp_billno = DateTime.Now.ToString("HHmmss") + TenPayUtil.BuildRandomStr(4);
}
else
{
sp_billno = Request["order_no"].ToString();
}
sp_billno = TenPayInfo.PartnerId + sp_billno;
//创建支付应答对象
RequestHandler packageReqHandler = new RequestHandler(Context);
//初始化
packageReqHandler.Init();
//设置package订单参数
packageReqHandler.SetParameter("partner", TenPayInfo.PartnerId); //商户号
packageReqHandler.SetParameter("fee_type", "1"); //币种,1人民币
packageReqHandler.SetParameter("input_charset", "GBK");
packageReqHandler.SetParameter("out_trade_no", sp_billno); //商家订单号
packageReqHandler.SetParameter("total_fee", "1"); //商品金额,以分为单位(money * 100).ToString()
packageReqHandler.SetParameter("notify_url", TenPayInfo.TenPayNotify); //接收财付通通知的URL
packageReqHandler.SetParameter("body", "JSAPIdemo"); //商品描述
packageReqHandler.SetParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
//获取package包
packageValue = packageReqHandler.GetRequestURL();
//调起微信支付签名
timeStamp = TenPayUtil.GetTimestamp();
nonceStr = TenPayUtil.GetNoncestr();
//设置支付参数
RequestHandler paySignReqHandler = new RequestHandler(Context);
paySignReqHandler.SetParameter("appid", appId);
paySignReqHandler.SetParameter("appkey", TenPayInfo.AppKey);
paySignReqHandler.SetParameter("noncestr", nonceStr);
paySignReqHandler.SetParameter("timestamp", timeStamp);
paySignReqHandler.SetParameter("package", packageValue);
paySign = paySignReqHandler.CreateSHA1Sign();
//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
//string pakcageDebuginfo = packageReqHandler.getDebugInfo();
//Response.Write("<br/>pakcageDebuginfo:" + pakcageDebuginfo + "<br/>");
//string paySignDebuginfo = paySignReqHandler.getDebugInfo();
//Response.Write("<br/>paySignDebuginfo:" + paySignDebuginfo + "<br/>");
}
开发者ID:CurryHan,项目名称:WeiXinMPSDK,代码行数:60,代码来源:jsapi.aspx.cs
示例5: CheckRoutes
public override string CheckRoutes(string url, RequestHandler r)
{
string[] segments = url.Split('?');
string path = server.settings.webRoot + segments[0];
if (url == "/")
{
if (Boolean.Parse(server.settings.dirListing))
SendContentHandler.SendDirectories(r.stream, DirectoryListing.Generate(path, server.settings.webRoot));
else
return server.settings.webRoot + "/" + server.settings.defaultPage;
}
else if (File.Exists(path))
{
return server.settings.webRoot + url;
}
else if (Directory.Exists(path))
{
if (Boolean.Parse(server.settings.dirListing))
SendContentHandler.SendDirectories(r.stream, DirectoryListing.Generate(path, server.settings.webRoot));
else
errorHandler.SendErrorPage(r.stream, 403);
}
else
{
errorHandler.SendErrorPage(r.stream, 404);
}
return null;
}
开发者ID:BioDice,项目名称:SEHACWebServer,代码行数:28,代码来源:ClientRouter.cs
示例6: TenPayV3ShortUrlRequestData
/// <summary>
/// 转换短链接 请求参数
/// </summary>
/// <param name="appId"></param>
/// <param name="mchId"></param>
/// <param name="signType"></param>
/// <param name="longUrl"></param>
/// <param name="key"></param>
/// <param name="nonceStr"></param>
public TenPayV3ShortUrlRequestData(string appId, string mchId, string nonceStr,
string longUrl, string key, string signType = "MD5")
{
AppId = appId;
MchId = mchId;
NonceStr = nonceStr;
SignType = signType;
LongUrl = longUrl;
Key = key;
#region 设置RequestHandler
//创建支付应答对象
PackageRequestHandler = new RequestHandler(null);
//初始化
PackageRequestHandler.Init();
//设置package订单参数
PackageRequestHandler.SetParameter("appid", this.AppId); //公众账号ID
PackageRequestHandler.SetParameter("mch_id", this.MchId); //商户号
PackageRequestHandler.SetParameter("long_url", this.LongUrl); //微信的订单号
PackageRequestHandler.SetParameter("nonce_str", this.NonceStr); //随机字符串
PackageRequestHandler.SetParameter("sign_type", this.SignType); //签名类型
Sign = PackageRequestHandler.CreateMd5Sign("key", this.Key);
PackageRequestHandler.SetParameter("sign", Sign); //签名
#endregion
}
开发者ID:JeffreySu,项目名称:WeiXinMPSDK,代码行数:36,代码来源:TenPayV3ShortUrlRequestData.cs
示例7: RegisterNavigator
/// <summary>
/// Registers request handlers that process room Navigator queries etc.
/// </summary>
public void RegisterNavigator()
{
mRequestHandlers[380] = new RequestHandler(SetFrontPageListening);
mRequestHandlers[381] = new RequestHandler(GuestRoomSearch);
mRequestHandlers[382] = new RequestHandler(GetPopularRoomTags);
mRequestHandlers[385] = new RequestHandler(GetGuestRoom);
}
开发者ID:habb0,项目名称:iondeltar,代码行数:10,代码来源:Navigator.cs
示例8: RequestHandlerRetryDecisionTest
public void RequestHandlerRetryDecisionTest()
{
var statement = new SimpleStatement("SELECT WILL FAIL");
var request = Session.GetRequest(statement);
var requestHandler = new RequestHandler<RowSet>(Session, request, statement);
//Using default retry policy the decision will always be to rethrow on read/write timeout
var expected = RetryDecision.RetryDecisionType.Rethrow;
var decision = requestHandler.GetRetryDecision(new ReadTimeoutException(ConsistencyLevel.Quorum, 1, 2, true));
Assert.AreEqual(expected, decision.DecisionType);
decision = requestHandler.GetRetryDecision(new WriteTimeoutException(ConsistencyLevel.Quorum, 1, 2, "SIMPLE"));
Assert.AreEqual(expected, decision.DecisionType);
decision = requestHandler.GetRetryDecision(new UnavailableException(ConsistencyLevel.Quorum, 2, 1));
Assert.AreEqual(expected, decision.DecisionType);
decision = requestHandler.GetRetryDecision(new Exception());
Assert.AreEqual(expected, decision.DecisionType);
//Expecting to retry when a Cassandra node is Bootstrapping/overloaded
expected = RetryDecision.RetryDecisionType.Retry;
decision = requestHandler.GetRetryDecision(new OverloadedException(null));
Assert.AreEqual(expected, decision.DecisionType);
decision = requestHandler.GetRetryDecision(new IsBootstrappingException(null));
Assert.AreEqual(expected, decision.DecisionType);
decision = requestHandler.GetRetryDecision(new TruncateException(null));
Assert.AreEqual(expected, decision.DecisionType);
}
开发者ID:Virus-X,项目名称:csharp-driver,代码行数:29,代码来源:RequestHandlerTests.cs
示例9: Server
public Server(FuSettings settings, RequestHandler handler)
{
this.Settings = settings;
this.Handler = handler;
ifStats(s => Stats = new Stats());
}
开发者ID:chakrit,项目名称:fu-sharp,代码行数:7,代码来源:Server.cs
示例10: LogoutTest
public void LogoutTest()
{
LoginData login = DefaultLoginData;
var requestHandler = new RequestHandler(login.UserName, login.Password, login.URL);
requestHandler.Login();
Assert.True(requestHandler.Logout());
}
开发者ID:sburnicki,项目名称:ODSCmdlets,代码行数:7,代码来源:ConnectRequestTests.cs
示例11: AddRequestHandler
public void AddRequestHandler(RequestHandler httpProcessor)
{
String requestUri = httpProcessor.getProcessorUri();
log.debug(requestUri, "requestUri");
_httpProcessors.Add(httpProcessor);
}
开发者ID:rlong,项目名称:dotnet.lib.HttpLibrary,代码行数:7,代码来源:RootRequestHandler.cs
示例12: ServerBase
public ServerBase(string[] urls, RequestHandler handler)
{
if (urls == null)
urls = new string[] { };
Urls = Array.AsReadOnly(urls);
Handler = handler;
}
开发者ID:chakrit,项目名称:plumber,代码行数:8,代码来源:ServerBase.cs
示例13: Create
public static Middleware Create(RequestHandler handler, RequestMiddleware[] requestModules, ResponseMiddleware[] responseModules)
{
Middleware m = new Middleware();
m.RequestModules = requestModules;
m.ResponseModules = responseModules;
m.Handler = handler;
return m;
}
开发者ID:tstone,项目名称:Fusion,代码行数:8,代码来源:Middleware.cs
示例14: CSharpServerImplementation
public CSharpServerImplementation()
{
myRegisterHandler = new RegisterHandler();
myElectionHelper = new ElectionHelper();
myRequestHandler = new RequestHandler();
myRequestCentralHandler = new RequestHandlerCentralized();
myResourceHandler = new ResourceHandler();
}
开发者ID:UkiMiawz,项目名称:data-communication,代码行数:8,代码来源:CSharpServerImplementation.cs
示例15: ConnectRequestHandler
public ConnectRequestHandler(Reference @ref, Ice.ObjectPrx proxy)
{
_reference = @ref;
_response = _reference.getMode() == Reference.Mode.ModeTwoway;
_proxy = (Ice.ObjectPrxHelperBase)proxy;
_initialized = false;
_flushing = false;
_requestHandler = this;
}
开发者ID:externl,项目名称:ice,代码行数:9,代码来源:ConnectRequestHandler.cs
示例16: RegisterPath
public void RegisterPath(string path, RequestHandler handler)
{
LOGGER.DebugFormat("Registering path {0}", path);
if (m_RequestHandlers.ContainsKey(path))
throw new InvalidOperationException(string.Format("Request path [{0}] is already registered to this JSON server!", path));
m_RequestHandlers[path] = handler;
}
开发者ID:nexaddo,项目名称:GuildWars2,代码行数:9,代码来源:HttpJsonServer.cs
示例17: ProcessRequestAsync
public ProcessRequestAsync()
{
var smtpClient = BackupSmtpClientBuilder.Build();
_emailDirectory = smtpClient.PickupDirectoryLocation;
if (!string.IsNullOrEmpty(_emailDirectory) && !Directory.Exists(_emailDirectory))
{
Directory.CreateDirectory(_emailDirectory);
}
_requestHandler = new RequestHandler(_emailDirectory);
}
开发者ID:fdore,项目名称:email4dev,代码行数:10,代码来源:ProcessRequestAsync.cs
示例18: BuildServer
public virtual IServer BuildServer(string host, int port, RequestHandler handler)
{
Assert.ArgumentNotNull(() => handler);
Assert.ArgumentSatisfy(() => host, s => !string.IsNullOrEmpty(s),
"Host cannot be null or empty.");
Assert.ArgumentSatisfy(() => port, p => 0 < p && p < 65536,
"Port must be between 0 and 65536 exclusive.");
return new HttpListenerServer(host, port, handler);
}
开发者ID:chakrit,项目名称:plumber,代码行数:10,代码来源:DefaultContainer.cs
示例19: RegisterUser
/// <summary>
/// Registers request handlers available from successful login.
/// </summary>
public void RegisterUser()
{
mRequestHandlers[7] = new RequestHandler(InfoRetrieve);
mRequestHandlers[8] = new RequestHandler(GetCredits);
mRequestHandlers[12] = new RequestHandler(MessengerInit);
mRequestHandlers[26] = new RequestHandler(ScrGetUserInfo);
mRequestHandlers[157] = new RequestHandler(GetBadges);
mRequestHandlers[233] = new RequestHandler(GetIgnoredUsers);
mRequestHandlers[370] = new RequestHandler(GetAchievements);
}
开发者ID:habb0,项目名称:iondeltar,代码行数:13,代码来源:User.cs
示例20: Applies_One_Constraint
public void Applies_One_Constraint()
{
var doesNotContainBlahConstraint = new Func<string, bool>(uri => uri.Contains("blah") == false);
var h = new RequestHandler("", null);
h.WithUrlConstraint(doesNotContainBlahConstraint);
var uriWithBlah = "http://www.blah.com";
Assert.That(h.CanVerifyConstraintsFor(uriWithBlah), Is.EqualTo(false));
}
开发者ID:mfilippov,项目名称:HttpMock,代码行数:12,代码来源:RequestHandlerTests.cs
注:本文中的RequestHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论