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


C# HttpGet类代码示例

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


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


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