日期:2014-05-17  浏览次数:21036 次

ASP.NET 表单和控件

?

ASP.NET 表单和控件

分类: ASP.NET 469人阅读 评论 (2) 收藏 举报

在今天我主要要介绍的有如下知识点:
HTML表单的提交方式
HTM控件
获取HTML表单内容
乱码问题
SQL注入
服务器端表单
HTML服务器控件

HTML表单的提交方式
对于一个普通HTML表单来说,它有两个重要的属性:action和method。
action属性指明当前表单提交之后由哪个程序来处理,这个处理程序可以是任何动态网页或者servlet或者CGI(Common Gateway Interface),在asp.net里面一般都是都aspx页面来处理。
method属性指明form表单的提交方式。它有两个可能值get和post。
下 面我们以一个例子来说明get和post的区别。用Dreamweaver8创建两个aspx页面,分别为Register.aspx和 GetUserInfo.aspx。暂时我们不需要在GetUserInfo.aspx页面写任何代码,Register.aspx页面的代码如下:

?

  1. < %@?Page? Language = "C#" ? ContentType = "text/html" ? ResponseEncoding = "gb2312" ?% >
  2. <!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. < html ? xmlns = "http://www.w3.org/1999/xhtml" >
  4. < head >
  5. < meta ? http-equiv = "Content-Type" ? content = "text/html;?charset=gb2312" ? />
  6. < title > 用户注册 </ title >
  7. </ head >
  8. < body >
  9. < form ? action = "GetUserInfo.aspx" ? method = "get" >
  10. < table ? border = "1" ? width = "400px" >
  11. < tr > < td ? colspan = "2" > 用户注册 </ td >