• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# HttpGet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中HttpGet的典型用法代码示例。如果您正苦于以下问题:C# HttpGet类的具体用法?C# HttpGet怎么用?C# HttpGet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HttpGet类属于命名空间,在下文中一共展示了HttpGet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HttpGetHandler

 public virtual IEnumerator<ITask> HttpGetHandler(HttpGet httpGet)
 {
     httpGet.ResponsePort.Post(new HttpResponseType(HttpStatusCode.OK,
         _state,
         _transform));
     yield break;
 }
开发者ID:rhogroup,项目名称:PanTilt,代码行数:7,代码来源:Biclops.cs


示例2: Should_Get_Web_Document

 public void Should_Get_Web_Document()
 {
     var httpGet = new HttpGet(20, "", "");
     httpGet.Request("http://www.google.co.uk");
     var document = httpGet.ResponseBody;
     Assert.IsTrue(document.Contains("google"));
 }
开发者ID:perryofpeek,项目名称:CCSkype,代码行数:7,代码来源:With_Request.cs


示例3: BaseStruct

 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="aActionId"></param>
 public BaseStruct(short aActionId, HttpGet httpGet)
     : base(System.Web.HttpContext.Current.Response, aActionId)
 {
     this.aAction = aActionId;
     this.httpGet = httpGet;
     InitAction(System.Web.HttpContext.Current.Response);
 }
开发者ID:rayphoenix333,项目名称:Scut,代码行数:11,代码来源:BaseStruct.cs


示例4: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;//new HttpResponse(sw);
            response.Charset = "unicode";// "unicode";
            HttpGet httpGet = new HttpGet();
            String ActionID = string.Empty;
            if (httpGet.GetString("ActionID", ref ActionID))
            {
                try
                {
                    string actionName = string.Concat("Action", ActionID);
                    string sname = string.Concat("ZyGames.DirCenter.Action." + actionName);
                    object[] args = new object[1];
                    args[0] = response;

                    BaseStruct obj = (BaseStruct) Activator.CreateInstance(Type.GetType(sname), new object[] { httpGet });
                    if (obj.ReadUrlElement() && obj.DoAction() && !obj.GetError())
                    {
                        obj.BuildPacket();
                        obj.WriteAction();
                    }
                    else
                    {
                        obj.WriteErrorAction();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    BaseLog oBaseLog = new BaseLog("DirCenterErrMain");
                    oBaseLog.SaveLog(ex);
                }
            }
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:34,代码来源:Service.aspx.cs


示例5: GetActionResponse

 /// <summary>
 /// 获取Action处理的输出字节流
 /// </summary>
 /// <returns></returns>
 public static byte[] GetActionResponse(int actionId, BaseUser baseUser, string parameters, out HttpGet httpGet)
 {
     string serverHost = string.Format("{0}:{1}", ActionConfig.Current.IpAddress, ActionConfig.Current.Port);
     string param = string.Format("MsgId={0}&St={1}&Sid={2}&Uid={3}&ActionID={4}{5}",
         0,
         "st",
         baseUser.GetSessionId(),
         baseUser.GetUserId(),
         actionId,
         parameters);
     httpGet = new HttpGet(param, baseUser.SocketSid, baseUser.RemoteAddress);
     BaseStruct baseStruct = FindRoute(ActionConfig.Current.TypeName, httpGet, actionId);
     SocketGameResponse response = new SocketGameResponse();
     baseStruct.UserFactory = uid => { return baseUser; };
     baseStruct.SetPush();
     baseStruct.DoInit();
     using (baseStruct.RequestLock())
     {
         if (!baseStruct.GetError() &&
             baseStruct.ReadUrlElement() &&
             baseStruct.DoAction() &&
             !baseStruct.GetError())
         {
             baseStruct.BuildPacket();
             baseStruct.WriteAction(response);
         }
         else
         {
             baseStruct.WriteErrorAction(response);
         }
     }
     return response.ReadByte();
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:37,代码来源:ActionFactory.cs


示例6: LoginProxy

 public LoginProxy(HttpGet httpGet)
 {
     this._httpGet = httpGet;
     if (_httpGet != null)
     {
         _httpGet.GetString("RetailID", ref retailID);
     }
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:8,代码来源:LoginProxy.cs


示例7: HttpServiceRequest

 /// <summary>
 /// 
 /// </summary>
 /// <param name="context"></param>
 public HttpServiceRequest(HttpContext context)
 {
     _buffer = new MessageStructure();
     httpGet = new HttpGet(context.Request);
     response = new HttpGameResponse(context.Response);
     ParamString = httpGet.ParamString;
     SessionId = httpGet.SessionId;
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:12,代码来源:HttpServiceRequest.cs


示例8: GenerateValidateCode

        /// <summary>
        /// 刷新验证码
        /// </summary>
        public void GenerateValidateCode()
        {
            //获取验证码和cookie
            HttpGet get = new HttpGet("https://dynamic.12306.cn/otsweb/passCodeNewAction.do?module=login&rand=sjrand");
            var imgName = Guid.NewGuid();
            var response = get.SendRequest();
            reqCookies = response.Cookies;
            string imgPath = Common.GetImageFromStream(response, Common.GetVirtualPath("\\ValidateCode\\" + imgName));

            this.pictureBox1.ImageLocation = imgPath;
        }
开发者ID:gofixiao,项目名称:12306,代码行数:14,代码来源:Form1.cs


示例9: OnRequested

 protected override void OnRequested(HttpGet httpGet, IGameResponse response)
 {
     try
     {
         ActionFactory.Request(httpGet, response, GetUser);
     }
     catch (Exception ex)
     {
         Console.WriteLine("OnRequested error:{0}", ex.Message);
     }
 }
开发者ID:WilliamRen,项目名称:Scut,代码行数:11,代码来源:GameHostApp.cs


示例10: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            HttpGet get = new HttpGet(string.Format("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag));
            string temp = string.Format("orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag);
            this.getParams(temp);
            string tests = string.Format("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag);
            get.req.Referer = "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init";
            get.req.CookieContainer.Add(reqCookies);
            string result = get.SendReqReturnResponseString();
            //string result = "0,<span id='id_330000K5980K' class='base_txtdiv' onmouseover=javascript:onStopHover('330000K5980K#BXP#WCN') onmouseout='onStopOut()'>K599</span>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;北京西&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;05:20,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;武昌&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;20:37,15:17,--,--,--,--,--,9,4,--,8,<font color='#008800'>有</font>,--,<a name='btn130_2' class='btn130_2' style='text-decoration:none;' onclick=javascript:getSelected('K599#15:17#05:20#330000K5980K#BXP#WCN#20:37#北京西#武昌#08#27#1*****30364*****00091*****00083*****0004#MUFFMDhDQTNCNEMzQjMwMTU4Qzg5NjdDODMxREI2MkNFODFDMThEREM3MzM0NDA5NEY0RTUzMTU6Ojo6MTM4MTMwMTIxMTg2MQ==#C1')>预&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订</a>";
            result = result.Replace("&nbsp;", string.Empty).Replace("<br>", string.Empty).
                Replace("<font color='#008800'>", string.Empty).Replace("</font>", string.Empty)
                .Replace("<img src='/otsweb/images/tips/first.gif'>", string.Empty)
                 .Replace("<img src='/otsweb/images/tips/last.gif'>", string.Empty)
                  .Replace("<font color='darkgray'>", string.Empty);

            string para1 = "onStopOut()'>";
            string para2 = "</span>";

            string[] trains = result.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
            List<TrainModel> trainList = new List<TrainModel>();
            foreach (string item in trains)
            {
                string[] data = item.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                TrainModel trainmodel = new TrainModel()
                {
                    checi = data[1].Substring(data[1].IndexOf(para1) + para1.Length).Replace(para2, string.Empty),
                    fazhan = data[2],
                    tostation = data[3],
                    lishi = data[4],
                    shangwu = data[5],
                    tedeng = data[6],
                    yideng = data[7],
                    erdeng = data[8],
                    gaojiruanwo = data[9],
                    ruanwo = data[10],
                    yingwo = data[11],
                    ruanzuo = data[12],
                    yingzuo = data[13],
                    wuzuo = data[14],
                    qita = data[15],
                    ordertiket = data[16]
                };
                trainList.Add(trainmodel);
            }

            this.dataGridView1.DataSource = trainList;
        }
开发者ID:gofixiao,项目名称:12306,代码行数:54,代码来源:order.cs


示例11: get

 public override string get(string uri)
 {
     try
     {
         // Prepare a request object
         HttpGet httpGet = new HttpGet(uri);
         HttpWebResponse response = execute(httpGet);
     }
     catch (UnknownHostException ex)
     {
     }
     return parseResponse(response);
 }
开发者ID:decriptor,项目名称:tomdroid,代码行数:13,代码来源:AnonymousConnection.cs


示例12: OnRequested

        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                var actionId = httpGet.ActionId;
                var uid = httpGet.GetString("uid");
                Console.WriteLine("Action{0} from {1} {2}", actionId, httpGet.RemoteAddress, uid);
                ActionFactory.Request(httpGet, response, GetUser);

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
        }
开发者ID:87170360,项目名称:Maximus,代码行数:15,代码来源:GameHostApp.cs


示例13: OnRequested

        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                var actionId = httpGet.ActionId;
                var uid = httpGet.GetString("uid");
                Console.WriteLine("Action{0} from {1} {2}", actionId, httpGet.RemoteAddress, uid);
                ActionFactory.Request(httpGet, response, userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:15,代码来源:GameHostApp.cs


示例14: SavePassenger

        public List<Passenger> SavePassenger()
        {
            HttpGet get = new HttpGet("https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getpassengerJson");
            get.req.CookieContainer.Add(reqCookies);
            string json = get.SendReqReturnResponseString();
            if (!string.IsNullOrEmpty(json))
            {
                try
                {
                    passengetList = JsonConvert.DeserializeObject<List<Passenger>>(JObject.Parse(json)["passengerJson"].ToString());

                    if (passengetList.Count > 0)
                    {
                        XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"));
                        XElement rootele = new XElement("data");
                        passengetList.ForEach(x =>
                        {
                            XElement city = new XElement("city");
                            city.SetAttributeValue("first_letter", x.first_letter);
                            city.SetAttributeValue("isUserSelf", x.isUserSelf);
                            city.SetAttributeValue("mobile_no", x.mobile_no);
                            city.SetAttributeValue("old_passenger_id_no", x.old_passenger_id_no);
                            city.SetAttributeValue("old_passenger_id_type_code", x.old_passenger_id_type_code);
                            city.SetAttributeValue("old_passenger_name", x.old_passenger_name);
                            city.SetAttributeValue("passenger_flag", x.passenger_flag);
                            city.SetAttributeValue("passenger_id_no", x.passenger_id_no);
                            city.SetAttributeValue("passenger_id_type_code", x.passenger_id_type_code);
                            city.SetAttributeValue("passenger_id_type_name", x.passenger_id_type_name);
                            city.SetAttributeValue("passenger_name", x.passenger_name);
                            city.SetAttributeValue("passenger_type", x.passenger_type);
                            city.SetAttributeValue("passenger_type_name", x.passenger_type_name);
                            city.SetAttributeValue("recordCount", x.recordCount);
                            city.SetValue(x.passenger_name);
                            rootele.Add(city);
                        });
                        xdoc.Add(rootele);
                        xdoc.Save(passengerXMLPath);
                        return passengetList;
                    }
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
            return null;
        }
开发者ID:gofixiao,项目名称:12306,代码行数:47,代码来源:confirmorder.cs


示例15: OnRequested

        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                //int actionId = 0;
                //if (httpGet.GetInt("actionId", ref actionId))
                //{
                //    Console.WriteLine("request actionId:{0}", actionId);

                //}
                ActionFactory.Request(httpGet, response, userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("d={0},{1}", httpGet.ParamString, ex.ToString());
            }
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:17,代码来源:AppGameHost.cs


示例16: GetAccessToken

        /// <summary>
        /// 获取AccessToken
        /// </summary>
        /// <returns>返回请求结果JSON字符串,AccessToken需自行根据不同应用进行提取</returns>
        public virtual string GetAccessToken(Dictionary<string, string> dic, HttpMethod.RequestMethod method)
        {
            UriBuilder uri = new UriBuilder(AccessTokenRequestUrl);
            string queryString = Common.BuildQueryString(dic);
            uri.Query = queryString;
            string result = string.Empty;

            if (method == HttpMethod.RequestMethod.GET) //GET请求
            {
                HttpGet get = new HttpGet(uri.ToString());
                result = get.SendReqReturnResponseString();
            }
            else if (method == HttpMethod.RequestMethod.POST) //POST请求
            {
                HttpPost post = new HttpPost(AccessTokenRequestUrl, queryString);
                result = post.SendReqReturnResponseString();
            }
            return result;
        }
开发者ID:gofixiao,项目名称:12306,代码行数:23,代码来源:OAuth_AuthorizationCode.cs


示例17: OnRequested

 protected override void OnRequested(HttpGet httpGet, IGameResponse response)
 {
     try
     {
         GuestUser user = null;
         if (_sessions.ContainsKey(httpGet.RemoteAddress))
         {
             user = _sessions[httpGet.RemoteAddress];
         }
         ActionFactory.Request(httpGet, response, GetUser);
         if (user != null)
         {
             httpGet.LoginSuccessCallback(user.UserId);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("OnRequested error:{0}", ex.Message);
     }
 }
开发者ID:Jachon,项目名称:Scut,代码行数:20,代码来源:GameHostApp.cs


示例18: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;//new HttpResponse(sw);
                response.Charset = "unicode";// "unicode";
                //Stopwatch a = new Stopwatch();
                //a.Start();
                HttpGet httpGet = new HttpGet(HttpContext.Current.Request);
                int ActionID = httpGet.ActionId;
                ActionFactory.Request("ZyGames.Tianjiexing.BLL.Action.Action{0},ZyGames.Tianjiexing.BLL", userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));

                //a.Stop();
                //TraceLog.WriteError("接口访问{0},{1}", ActionID, a.Elapsed.TotalMilliseconds);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
            }
        }
开发者ID:rayphoenix333,项目名称:Scut,代码行数:20,代码来源:Service.aspx.cs


示例19: Action100

 public Action100(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action100, httpGet)
 {
     _roomStruct = new MemoryCacheStruct<UserConnection>();
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:5,代码来源:Action100.cs


示例20: Action5205

 public Action5205(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action5205, httpGet)
 {
 }
开发者ID:0jpq0,项目名称:Scut,代码行数:4,代码来源:Action5205.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpHeaderValueCollection类代码示例发布时间:2022-05-24
下一篇:
C# HttpFile类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap