提交页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" action="Default9.aspx">
<label>用户名
<input type="text" name="user" id="Text1" />
</label>
<p>
<label>密码
<input type="password" name="password" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
</body>
</html>
获得值页面代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strName = Request.Form["user"];
string strPwd = Request.Form["password"];
Response.Write("您的用户名如下所示");
Response.Write(strName+"<br>");
Response.Write("您的密码如下所示");
Response.Write(strPwd);
}
}
为什么不输出用户名和密码呢?麻烦看看
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" action="Default9.aspx">
<label>用户名
<input type="text" name="user" id="Text1" />
</label>
<p>
<label>密码
<input type="password" name="password" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
</body>
</html>
获得值页面代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strName = Request.Form["user"];
string strPwd = Request.Form["password"];
Response.Write("您的用户名如下所示");
Response.Write(strName+"<br>");
Response.Write("您的密码如下所示");
Response.Write(strPwd);
}
}
为什么不输出用户名和密码呢?麻烦看看
解决方案 »
- 学C#有一个月了。期间写了串口通信的程序,对于多线程还是不理解
- vs2008把b/s程序打包成:能在只按照Framework2.0的机器是运行的安装包。
- 紧急求助!!!请教各位大虾,在C# 程序中,如何才能调用出来那个搜索替换的对话框啊!!!十分感谢赐教
- 关于文件下载
- SqlDataAdapter.Update() 批量更新到数据库的问题,你要挑战吗?50分,
- 带参sql 插入数据时调用select last_insert_id()
- 各位如果把数据库中的存储过程当做类来处理如何?
- C#里面怎么没有delete,new出的对象想自己删除,怎么办。另外,类里没有析构函数,怎么回事。
- 怎么在ListView上加垂直或水平滚动条,请大家指教
- 这段A代码我应该插到B代码的那里?或有其它方法?
- 怎样将一串ASCII字符转换为TextBox可以识别的字符串
- 求两个数组合并,取交集算法
改成:<form id="Form1" method="post" runat="server">
即可!
<input type="text" name="user" id="Text1" />
用submit 提交,就不要再用 id="Text1" 除非有javascrtipt 调用