zoukankan      html  css  js  c++  java
  • post from传值

    //请求
                string url = "http://localhost:50186/GetPostPage.aspx";
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

                string s = "LeoTest=2013";
                byte[] requestBytes = System.Text.Encoding.UTF8.GetBytes(s);
                req.Method = "POST";
                req.ContentType = "application/x-www-form-urlencoded";
                req.ContentLength = requestBytes.Length;
                Stream requestStream = req.GetRequestStream();
                requestStream.Write(requestBytes, 0, requestBytes.Length);
                requestStream.Close();


                ///1,读取
                //HttpWebResponse res = (HttpWebResponse)req.GetResponse();
                //StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8);
                //string backstr = sr.ReadToEnd();
                //this.TextBox1.Text = backstr;

                //sr.Close();
                //res.Close();

                //2,打印输出
                Response.Redirect(url);

    __________________________________

    if (Request.Form["LeoTest"] != null)
                {
                    Response.Write("OK");
                }
                else
                {
                    Response.Write("ON");
                }
                Response.End();

  • 相关阅读:
    java例题 汽油检测
    java常用api
    二分搜索法
    java例题
    java基础
    表单验证
    4.10 pm例题
    0805
    0731 框架Mybatis
    小结
  • 原文地址:https://www.cnblogs.com/binbinxiong/p/3309176.html
Copyright © 2011-2022 走看看