本文整理汇总了C#中RequestInfo.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RequestInfo.ToString方法的具体用法?C# RequestInfo.ToString怎么用?C# RequestInfo.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestInfo
的用法示例。
在下文中一共展示了RequestInfo.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSubmit
void DoSubmit()
{
RequestInfo ri = new RequestInfo();
ri.Url = txtUrl.Text.Trim();
ri.IsPost = cbIsPost.Checked;
ri.Params = new Dictionary<string, string>();
ri.RequestTime = DateTime.Now;
foreach (KeyValuePair<string,string> kvp in dicParams)
{
ri.Params.Add(kvp.Key, kvp.Value);
}
rtbResponse.Text = string.Format("正在向{0}提交请求...",ri.FullUrl);
HttpClient hc;
string responseText = string.Empty;
if (ri.IsPost)
{
//ServicePointManager.Expect100Continue = false;
hc = new HttpClient(ri.Url);
hc.Verb = HttpVerb.POST;
hc.RequestEncoding = GetRequestEncoding();
foreach (KeyValuePair<string,string> kvp in ri.Params)
{
hc.PostingData.Add(kvp.Key, kvp.Value);
}
responseText = hc.GetString();
}
else
{
hc = new HttpClient(ri.FullUrl);
hc.RequestEncoding = GetRequestEncoding();
responseText = hc.GetString();
}
rtbResponse.Text = responseText;
lbHistory.Items.Add(ri.ToString());
dic.Add(ri.ToString(), ri);
webBrowser1.DocumentText = responseText;
this.Clear();
}
示例2: Process
/// <summary>
/// 入口
/// </summary>
/// <param name="context"></param>
/// <param name="info"></param>
public void Process(HttpContext context, out RequestInfo info)
{
info = null;
if (context.Request.RawUrl.IndexOf(this.config.StatusKey) >= 0)
{
EchoStatus(context);
return;
}
var rule = setting.Rules.Get(context);
if (rule != null)
{
if (EchoClientCache(context, rule.ConfigRule.CacheSeconds))
{
context.ApplicationInstance.CompleteRequest();
return;
}
context.Response.AddHeader("PageCache", "Powered by https://github.com/me15000");
info = RequestInfo.Create(context, rule);
if (info != null)
{
//requestQueue.In(info);
if (accessLog != null)
{
accessLog.Write(info.ToString());
}
if (!EchoData(info))
{
context.Response.StatusCode = 504;
if (errorLog != null)
{
errorLog.Write(SYSTEM_ERROR_MESSAGE + info.ToString());
}
}
context.ApplicationInstance.CompleteRequest();
//requestQueue.Out(info);
}
}
}