尴尬猫 2018-11-29 01:58 采纳率: 0%
浏览 620

c# 怎么把winform应用程序的textbox.text的字符传给网页上的textbox.text中?--本人小白一枚

请教各位大神:
客户端有个按钮,按钮代码如下

private void button4_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
string postString = "data1=" + textBox1.Text ;

byte[] postData = Encoding.UTF8.GetBytes(postString);

        byte[] byRemoteInfo = wc.UploadData("http://localhost:2110/valueDisplay.aspx", "POST", postData);

        string _RemoteInfo = System.Text.Encoding.UTF8.GetString(byRemoteInfo);

        textBox51.Text = _RemoteInfo;
            }

            网页端代码写如下代码时,winform程序中的textbox51.text能够得到返回的字符。
            protected void Page_Load(object sender, EventArgs e)
{
    Response.Write(Request.Form["data1"]);
    Response.Write("收到OK!");
    Response.End();    
}
    但是我想在网页的控件textbox.text显示传递的数值应该怎么写
  • 写回答

3条回答

  • threenewbee 2018-11-29 03:30
    关注

    客户端应该没问题

    网页
    protected void Page_Load(object sender, EventArgs e)
    string s = Request.Forms["data"].tostring();
    ...

    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题