有关ASP.NET的一些基本说明,解释
点击次数:24 次 发布日期:2008-11-26 23:28:42 作者:源代码网
|
源代码网推荐 <%@ directive attribute=value %>比如: 源代码网推荐 <%import namespace=”System.Data”%> 源代码网推荐 源代码网推荐 注意属性之间需要空格,在"="之间不能有空格。 源代码网推荐 源代码网推荐 asp.net的web forms 中现在包含以下7种标识 源代码网推荐 源代码网推荐 @ Page,@ Control,@ Import,@ Registe,@ Assembly,@ OutputCache 源代码网推荐 源代码网推荐 @ Page 标识我们常用的属性是 Language 比如 <%@ Page Language="VB" %>,另外他还可以确定这个页面的 字符集,ResponseEncoding=gb2312 源代码网推荐 是否允许调试:Trace=True 表示如果抱错,显示错误信息 否则反之 源代码网推荐 警告是否显示:Warnings=True 表示如果程序中有不合理的地方,虽然只是警告,仍然显示成为错误等等,具体应用可见:ASP.NET 中文显示的两种解决方法 源代码网推荐 源代码网推荐 @ Control 并非使用在 aspx 文件中,而是使用在 ascx 文件,也就是 拥护子定义控件的文件中,在一个ascx 文件中只能有一个 @ Control 标识 源代码网推荐 源代码网推荐 @ Import 是我们可能最常用的一个标识 ,当我们使用一些特殊的aspx特性的时候,为了告诉编译器我们的目的,我们就需要使用这个标识,常用的标识 我已经在前面的文章中 讲过了,如果 不使用 @import 我们默认就已经可以使用 如下的一些 命名空间(NameSpace) 源代码网推荐 System 源代码网推荐 System.Collections 源代码网推荐 System.IO 源代码网推荐 System.Web 源代码网推荐 System.Web.UI 源代码网推荐 System.Web.UI.HtmlControls 源代码网推荐 System.Web.UI.WebControls 源代码网推荐 源代码网推荐 @ Register 是当我们在 aspx 文件中调用我们的 子定义组件的pagelet 的时候,对 这个pagelet 进行注册的时候使用的,通过这个标识,我们 就可以 在 这个 aspx 文件中使用 我们自己的 NameSpace(连接到文章PAGELET的使用一文) 源代码网推荐 源代码网推荐 @ Assembly 指出我们编译aspx 文件的时候需要使用什么额外的编译器,用法如下: 源代码网推荐 <%@ Assembly src="DocName" %> src 指向的是后缀为 cs 或者 vb 的文件,这将使这些文件中的 CLASS 被包含进当前的页面中 源代码网推荐 源代码网推荐 @OutputCache .aspx文件的内容在服务器上保留的时间的长度(连接……) 源代码网推荐 <%@ OutputCache duration=”1000” %> 源代码网推荐 这里定义的Cache 存留时间为1000秒 源代码网推荐 源代码网推荐 @ Webservice 引用一个WebService 的类。用法如下: 源代码网推荐 <%@ WebService Language="language" Class="classname" %> 源代码网推荐 <a href=”http://www.gotdotnet.com/quickstart/aspplus/”> 源代码网推荐 Web Service Type Marshalling</a> 源代码网推荐 源代码网推荐 源代码网推荐 源代码网供稿. |
