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

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 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?