您的位置:首页 > 其它

.net 响应form请求

2016-07-12 13:01 218 查看
<form action="http://localhost:6069/index.aspx" method="post">
<input type="text" name="name" />
<input type="tel" name="tel"/>
<input type="text" name="age"/>
<input type="submit" text="提交" />
</form>

if (Request.Form["name"] != null && Request.Form["tel"] != null)
{
string name = Request.Form["name"];
string tel = Request.Form["tel"];

if (name.Length > 3 && tel.Length == 11)
{
Response.Write("OK");
}
else
{
Response.Write("姓名:" + name + "  手机:" + tel);
}
}


以上是Post提交方式,如果使用Get提交方式后台需要用Request..QueryString["name"]来接收;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  .net