当前位置: 首页>>代码示例>>C#>>正文


C# RequestInfo.ToString方法代码示例

本文整理汇总了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();
        }
开发者ID:Leafney,项目名称:Kalman.Studio,代码行数:45,代码来源:WebSubmitter.cs

示例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);
                }
            }
        }
开发者ID:sdgdsffdsfff,项目名称:PageCache,代码行数:54,代码来源:CacheService.cs


注:本文中的RequestInfo.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。