web form表单get 和post传值

来源:互联网 发布:java实现转盘抽奖系统 编辑:程序博客网 时间:2024/05/19 00:50

1、利用method="get" 和enctype="text/plain"传值到Handler1.ashx页面:

html代码:

<form name="form1" method="get" action="Handler1.ashx"  enctype="text/plain">        <input id="Submit1" type="submit" value="submit" />        <input id="Text1" name="Text1" type="text" />    </form>
Handler1.ashx代码:

 string str = context.Request["Text1"];

form表单中method="post"提交:

取值:Request.Form["Text1"];

form表单中method="get"提交:

Request.QueryString["Text1"];

Request["Text1"];


AJAX中type=get传值:
取值:
  context.Request.QueryString["ProjectName"];
  context.Request["ProjectName"];


AJAX中type=post传值:
取值:
  context.Request.Form["ProjectName"];
  context.Request["ProjectName"];


2、利用method="post"和enctype="multipart/form-data"上传文件:

if(context.Request.Files.Count)>0




文档说明:http://blog.csdn.net/u014424282/article/details/77881965

原创粉丝点击